Skip to content

Console Tools


isTTYAvailable

Quiet test for a TTY

Usage

isTTYAvailable [ --help ]

Returns 0 if a tty is available, 1 if not. Caches the saved value in __BUILD_HAS_TTY to avoid running the test each call.

Location: bin/build/tools/colors.sh

Arguments

  • --help - Flag. Optional. Display this help.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

See Also

consoleGetColor

Get the console foreground or background color

Usage

consoleGetColor [ --foreground ] [ --background ]

Gets the RGB console color using an xterm escape sequence supported by some terminals. (usually for background colors)

Location: bin/build/tools/console.sh

Arguments

  • --foreground - Flag. Optional. Get the console text color.
  • --background - Flag. Optional. Get the console background color.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

consoleConfigureColorMode

Print the suggested color mode for the current environment

Usage

consoleConfigureColorMode [ backgroundColor ]

Print the suggested color mode for the current environment

Location: bin/build/tools/console.sh

Arguments

  • backgroundColor - String. Optional. Background color.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

consoleConfigureDecorate

Modify the decoration environment for light or dark.

Usage

consoleConfigureDecorate [ backgroundColor ] [ --help ]

Modify the decoration environment for light or dark.

Run this at the top of your script for best results.

Update the color scheme for a light or dark scheme

Location: bin/build/tools/console.sh

Arguments

  • backgroundColor - String. Optional. Background color.
  • --help - Flag. Optional. Display this help.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

consoleColumns

Column count in current console

Usage

consoleColumns [ --help ]

Output the number of columns in the terminal. Default is 80 if not able to be determined from TERM.

Location: bin/build/tools/colors.sh

Arguments

  • --help - Flag. Optional. Display this help.

Writes to standard output

Integer

Examples

textRepeat $(consoleColumns)

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

    • COLUMNS - May be defined after calling this
    • LINES - May be defined after calling this

See Also

consoleRows

Row count in current console

Usage

consoleRows [ --help ]

Output the number of columns in the terminal. Default is 60 if not able to be determined from TERM.

COLUMNS and LINES environment variables may be modified by calling this function.

Location: bin/build/tools/colors.sh

Arguments

  • --help - Flag. Optional. Display this help.

Examples

tail -n $(consoleRows) "$file"

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Environment

  • COLUMNS LINES

See Also

consoleBrightness

Output the brightness of the background color of the console as a number between 0 and 100

Usage

consoleBrightness [ --foreground ] [ --background ]

Fetch the brightness of the console using consoleGetColor

Location: bin/build/tools/console.sh

Arguments

  • --foreground - Flag. Optional. Get the console text color.
  • --background - Flag. Optional. Get the console background color.

Sample Output

Integer. between 0 and 100.

Return codes

  • 0 - Success
  • 1 - A problem occurred with consoleGetColor

See Also

consoleSetTitle

Set the title of the window for the console

Usage

consoleSetTitle

Set the title of the window for the console

Location: bin/build/tools/console.sh

Arguments

  • none

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

consoleDefaultTitle

Set the title of the window for the console to

Usage

consoleDefaultTitle [ None ]

Set the title of the window for the console to "user@hostname: pwd"

Location: bin/build/tools/console.sh

Arguments

  • None

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

console hyperlinks

Usage

consoleLink link [ text ] [ --help ]

Output a hyperlink to the console OSC 8 standard for terminals No way to test ability, I think. Maybe tput.

Location: bin/build/tools/console.sh

Arguments

  • link - EmptyString. Required. Link to output.
  • text - String. Optional. Text to display, if none then uses link.
  • --help - Flag. Optional. Display this help.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

Output a local file link to the console

Usage

consoleFileLink [ --no-app ] fileName [ text ]

Output a local file link to the console

Location: bin/build/tools/console.sh

Arguments

  • --no-app - Flag. Optional. Do not map the application path in decoratePath
  • fileName - String. Required. File path to output.
  • text - String. Optional. Text to output linked to file.

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

consoleLinksSupported

Are console links (likely) supported?

Usage

consoleLinksSupported

Are console links (likely) supported? Unfortunately there's no way to test for this feature currently

Location: bin/build/tools/console.sh

Arguments

  • none

Return codes

  • 0 - Success
  • 1 - Environment error
  • 2 - Argument error

🛠️ Tools · ⬅ Top