Skip to content

Instantly share code, notes, and snippets.

@jbadger3
Created September 9, 2022 17:35
Show Gist options
  • Save jbadger3/2b2da6dde839bb88db36c2e472eff621 to your computer and use it in GitHub Desktop.
Save jbadger3/2b2da6dde839bb88db36c2e472eff621 to your computer and use it in GitHub Desktop.
on_command_line_applications_in_swift
import Foundation
import Terminus
let terminal = Terminal.shared
var attributedString = AttributedString("Hello, bold, underlined, world.")
if let boldRange = attributedString.range(of: "bold") {
attributedString[boldRange].terminalTextAttributes = [.bold]
}
if let underlinedRange = attributedString.range(of: "underlined") {
attributedString[underlinedRange].terminalTextAttributes = [.underline]
}
terminal.write(attributedString: attributedString)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment