Provide bash-completion an aliases for availale sequences including installation script
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
## Version information
|
||||
|
||||
VERSION_REV=13
|
||||
VERSION_MAJOR=1
|
||||
VERSION_MINOR=1
|
||||
VERSION_MAJOR=2
|
||||
VERSION_MINOR=0
|
||||
|
||||
## Start of generic script part
|
||||
|
||||
@@ -59,23 +59,24 @@ helpSequencer() {
|
||||
Usage: ${0##*/} [OPTIONS] [STEP NUMBER(s) or ALIAS] [STEP ARGUMENTS]
|
||||
|
||||
[OPTIONS]
|
||||
--config, -c : Open sequence configuration file (also sets -qq)
|
||||
--dry-run, -d : Only print to console what would be done
|
||||
! Attention - Sequence must support this
|
||||
--help, -h : Display help
|
||||
--helpapi, -ha : Display help about build-in supporting functions
|
||||
(e.g. exe,addconf,echerr,...)
|
||||
--profile, -p : Sequence configuration profile name (default: "default")
|
||||
(if supported by sequence)
|
||||
-pl : List available profiles
|
||||
--quiet, -q : Don't ask for permission to execute steps
|
||||
If called without starting step number, only this help is shown
|
||||
-qq : Same as --quiet but suppresses regular sequencer.sh output
|
||||
--single, -s : Execute only one step
|
||||
If more than one step is requested, only the first will be executed
|
||||
--verbose, -v : Verbose output (use exe() function to call shell commands in seqs)
|
||||
( e.g.: exe apt update )
|
||||
--version : Display version of sequencer and revision of sequence
|
||||
--config, -c : Open sequence configuration file (also sets -qq)
|
||||
--dry-run, -d : Only print to console what would be done
|
||||
! Attention - Sequence must support this
|
||||
--help, -h : Display help
|
||||
--helpapi, -ha : Display help about build-in supporting functions
|
||||
(e.g. exe,addconf,echerr,...)
|
||||
--liststeps, -ls : List all step numbers and alias
|
||||
--profile, -p : Sequence configuration profile name (default: "default")
|
||||
(if supported by sequence)
|
||||
-pl : List available profiles
|
||||
--quiet, -q : Don't ask for permission to execute steps
|
||||
If called without starting step number, only this help is shown
|
||||
-qq : Same as --quiet but suppresses regular sequencer.sh output
|
||||
--single, -s : Execute only one step
|
||||
If more than one step is requested, only the first will be executed
|
||||
--verbose, -v : Verbose output (use exe() function to call shell commands in seqs)
|
||||
( e.g.: exe apt update )
|
||||
--version : Display version of sequencer and revision of sequence
|
||||
|
||||
[STEP NUMBER"(s)" 1-${MAX_STEP} or ALIAS]
|
||||
No STEP or ALIAS : assume 1 as starting point
|
||||
@@ -995,6 +996,38 @@ displayHelp() {
|
||||
CONTEXT_HELP=0
|
||||
}
|
||||
|
||||
# listSteps [FILTER STRING]
|
||||
# [FILTER STRING]
|
||||
# show only steps and aliases starting with [FILTER STRING]
|
||||
listSteps() {
|
||||
local aList=()
|
||||
local aSearch="$1"
|
||||
local locAlias=
|
||||
|
||||
for ((i=1; i<=${MAX_STEP}; i++)); do
|
||||
# Display step reference in help if step function exists
|
||||
existsFunction step_${i}
|
||||
[ $? -ne 0 ] && continue
|
||||
|
||||
# Display alias if exists
|
||||
existsFunction step_${i}_alias
|
||||
if [ $? -eq 0 ] ; then
|
||||
step_${i}_alias
|
||||
locAlias=("$ALIAS")
|
||||
else
|
||||
locAlias=("$i")
|
||||
fi
|
||||
|
||||
if [ -z "$aSearch" ]; then
|
||||
aList+=("$locAlias")
|
||||
elif [[ "$locAlias" =~ ^$aSearch ]]; then
|
||||
aList+=("$locAlias")
|
||||
fi
|
||||
done
|
||||
|
||||
[ ${#aList[@]} -ne 0 ] && echo "${aList[@]}"
|
||||
}
|
||||
|
||||
# showVersion
|
||||
showVersion() {
|
||||
echo "Sequencer ${VERSION_STRING}"
|
||||
@@ -1056,6 +1089,10 @@ main() {
|
||||
--helpapi|-ha) #show build-in functions
|
||||
helpApi
|
||||
exit 0;;
|
||||
--liststeps|-ls)
|
||||
shift
|
||||
listSteps "$1"
|
||||
exit 0;;
|
||||
--profile|-p) # seq profile name
|
||||
SEQUENCER_ARGS+=" $1 $2"
|
||||
shift
|
||||
|
Reference in New Issue
Block a user