Skip to content

Latest commit

 

History

History
100 lines (62 loc) · 5.71 KB

bashful.md

File metadata and controls

100 lines (62 loc) · 5.71 KB

Bashful Module: bashful

Overview

Purpose: Provides functions to: track and determine whether Bashful modules have been loaded; inspect the state of variables and functions; write output to STDOUT and STDERR.

Script: bashful.inc.sh

Unit Test Scripts: No unit test scripts exist for bashful.

Requires Modules: None

Required By Modules: error, opts

Global Variables

Variable Name Purpose
BASHFUL_LOADED_[module_name] Exists for every Bashful module that has been loaded
BASHFUL_PATH The path in which Bashful modules are located
BASHFUL_VERSION The Bashful version number
SCRIPT_DEBUG_LEVEL A script debugging level variable that can be used to determine whether certain types of output get echoed to the TTY
SCRIPT_INVOKED_NAME The path and name of the calling script
SCRIPT_INVOKED_PATH The path of the calling script
SCRIPT_NAME The name of the calling script
SCRIPT_RUN_DATE The date and time at which the script included Bashful

Functions

Function Index

Function Name Description
ifDebug Returns true if the current debugging level is greater than or equal to the specified debugging level.
indexOf Searches for the first specified string within the subsequent list of string parameters, and returns the numeric index at which the searched string first occurs.
isFunction Returns true if the specified function name exists as a defined function.
isModuleLoaded Returns true if the specified Bashful module name has been loaded.
isScriptInteractive Returns true if the currently executed script was invoked from an interactive TTY session.
isScriptSourced Returns true if the currently executed script was sourced, rather than executed.
isScriptSshCommand Returns true if the currently executed script was executed as an SSH command.
isVariableSet Returns true if the specified variable name exists as a defined variable, and is set.
stderr Echoes the piped input to STDERR, and returns the status code that was either passed in, or resulting from the last executed command.
stderr_ifDebug Echoes the piped input to STDERR if the current SCRIPT_DEBUG_LEVEL is greater than or equal to the specified debug level, and returns the status code that was either passed in, or resulting from the last executed command.
stdout Echoes the piped input to STDOUT, and returns the status code that was either passed in, or resulting from the last executed command.
stdout_ifDebug Echoes the piped input to STDOUT if the current SCRIPT_DEBUG_LEVEL is greater than or equal to the specified debug level, and returns the status code that was either passed in, or resulting from the last executed command.
verifyBashfulDependencies Verifies that all required Bashful modules have been loaded as necessary. If one or more required modules have not been loaded, generates an error message and returns a non-success status code.

Function API

ifDebug

Description: Returns true if the current debugging level is greater than or equal to the specified debugging level.

indexOf

Description: Searches for the first specified string within the subsequent list of string parameters, and returns the numeric index at which the searched string first occurs.

isFunction

Description: Returns true if the specified function name exists as a defined function.

isModuleLoaded

Description: Returns true if the specified Bashful module name has been loaded.

isScriptInteractive

Description: Returns true if the currently executed script was invoked from an interactive TTY session.

isScriptSourced

Description: Returns true if the currently executed script was sourced, rather than executed.

isScriptSshCommand

Description: Returns true if the currently executed script was executed as an SSH command.

isVariableSet

Description: Returns true if the specified variable name exists as a defined variable, and is set.

stderr

Description: Echoes the piped input to STDERR, and returns the status code that was either passed in, or resulting from the last executed command.

stderr_ifDebug

Description: Echoes the piped input to STDERR if the current SCRIPT_DEBUG_LEVEL is greater than or equal to the specified debug level, and returns the status code that was either passed in, or resulting from the last executed command.

stdout

Description: Echoes the piped input to STDOUT, and returns the status code that was either passed in, or resulting from the last executed command.

stdout_ifDebug

Description: Echoes the piped input to STDOUT if the current SCRIPT_DEBUG_LEVEL is greater than or equal to the specified debug level, and returns the status code that was either passed in, or resulting from the last executed command.

verifyBashfulDependencies

Description: Verifies that all required Bashful modules have been loaded as necessary. If one or more required modules have not been loaded, generates an error message and returns a non-success status code.