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.ZL
Arguments
--help- Optional. Flag. Display this help.
Return codes
0- Success1- Environment error2- Argument error
Environment
-
__BUILD_HAS_TTY- Cached value offalseortrue. Any other value forces computation during this call.
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)
Arguments
--foreground- Optional. Flag. Get the console text color.--background- Optional. Flag. Get the console background color.
Return codes
0- Success1- Environment error2- Argument error
consoleConfigureColorMode
Print the suggested color mode for the current environment
Usage
consoleConfigureColorMode [ backgroundColor ]
Print the suggested color mode for the current environment
Arguments
backgroundColor- Optional. String. Background color.
Return codes
0- Success1- Environment error2- 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.
Side Effect: MAY define two environment variables
Writes to standard output
Integer
Arguments
--help- Optional. Flag. Display this help.
Examples
repeat $(consoleColumns)
Return codes
0- Success1- Environment error2- Argument error
Environment
-
COLUMNS- May be defined after calling this
-
LINES- May be defined after calling this
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.
Side Effect: MAY define two environment variables
Arguments
--help- Optional. Flag. Display this help.
Examples
tail -n $(consoleRows) "$file"
Return codes
0- Success1- Environment error2- Argument error
Environment
-
COLUMNS- May be defined after calling this
-
LINES- May be defined after calling this
consoleBrightness
Fetch the brightness of the console using
consoleGetColor
Usage
consoleBrightness [ --foreground ] [ --background ]
Fetch the brightness of the console using consoleGetColor
Return Code: 0 - Success
Return Code: 1 - A problem occurred with consoleGetColor
Arguments
--foreground- Optional. Flag. Get the console text color.--background- Optional. Flag. Get the console background color.
Sample Output
Integer. between 0 and 100.
Return codes
0- Success1- Environment error2- Argument error
consoleSetTitle
Set the title of the window for the console
Usage
consoleSetTitle
Set the title of the window for the console
Arguments
- none
Return codes
0- Success1- Environment error2- 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"
Arguments
- None
Return codes
0- Success1- Environment error2- Argument error
consoleLink
Output a hyperlink to the console
Usage
consoleLink
Output a hyperlink to the console
OSC 8 standard for terminals
No way to test ability, I think. Maybe tput.
Arguments
- none
Return codes
0- Success1- Environment error2- Argument error
consoleFileLink
Output a local file link to the console
Usage
consoleFileLink [ --no-app ] fileName [ text ]
Output a local file link to the console
Arguments
--no-app- Flag. Optional. Do not map the application path indecoratePathfileName- Required. File path to output.text- Optional. Text to output linked to file.
Return codes
0- Success1- Environment error2- 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
Arguments
- none
Return codes
0- Success1- Environment error2- Argument error