import.sh
- import bash modules into scripts or into
interactive shell
. import.sh MODULE[...]
- import module(s) into script
or shellsource import.sh MODULE[...]
- same as above, but with
source
instead of .
import.sh --help|-h
- print this help textimport.sh --man
- show manualimport.sh --list
- list modules with their pathimport.sh --summary|-s [MODULE...]
- list module(s)
with summaryimport.sh --usage|-u MODULE[...]
- print module help
textimport.sh --doc|-d MODULE[...]
- print module
documentationImports given module(s) into current shell.
Use:
import.sh --list
- to print list of available
modules.import.sh --summary
- to print list of available
modules with short description.import.sh --usage MODULE[...]
- to print longer
description of given module(s).BASH_MODULES_PATH
- ‘:’ separated list of your own
directories with modules, which will be prepended to module search path.
You can set __IMPORT__BASE_PATH
array in script at
begining, in /etc/bash-modules/config.sh
, or in
~/.config/bash-modules/config.sh
file.
__IMPORT__BASE_PATH
- array with list of directories
for module search. It’s reserved for internal use by
bash-modules.
/etc/bash-modules/config.sh
- system wide
configuration file. WARNING: Code in this script will affect all
scripts.
Put following snippet into
~/.config/bash-modules/config.sh
file:
# Enable stack trace printing for warnings and errors,
# like with --debug option:
__log__STACKTRACE=="yes"
# Add additional directory to module search path:
BASH_MODULES_PATH="/home/user/my-bash-modules"
~/.config/bash-modules/config.sh
- user configuration
file. WARNING: Code in this script will affect all user
scripts.IMPORT__BIN_FILE
- script main file name,
e.g. /usr/bin/my-script
, as in $0
variable in
main file.import::import_module MODULE
- import single module
only.
import::import_modules MODULE[...]
- import
module(s).
import::list_modules FUNC [MODULE]...
- print
various information about module(s). FUNC
is a function to
call on each module. Function will be called with two arguments: path to
module and module name. Rest of arguments are module names. No arguments
means all modules.
import::show_documentation LEVEL PARSER FILE
- print
module built-in documentation. This function scans given file for lines
with “#>” prefix (or given prefix) and prints them to stdout with
prefix stripped.
LEVEL
- documentation level (one line summary, usage,
full manual):
#>
and #>>
and
#>>>
),#>>
and
#>>>
),#>>>
),##
.FILE
- path to file with built-in documentation.