Terminal

Set of useful terminal functions.

Table of Contents


terminal::is_term()

Check if script is run in terminal.

Function has no arguments.

Exit codes

  • 0: If script is run on terminal.
  • 1: If script is not run on terminal.

terminal::detect_profile()

Detect profile rc file for zsh and bash of current script running user.

Function has no arguments.

Exit codes

  • 0: If script is run on terminal.
  • 1: If script is not run on terminal.

Output on stdout

  • path to the profile file.

terminal::clear_line()

Clear the output in terminal on the specified line number. This function clears line only on terminal.

Arguments

  • $1 (Line): number to clear. Defaults to 1. (optional)

Exit codes

  • 0: If script is run on terminal.

Output on stdout

  • clear line ansi code.