sequencer - new options -- (end options) ++ (quick start step 1)
Update template
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
## Version information
|
## Version information
|
||||||
|
|
||||||
VERSION_REV=15
|
VERSION_REV=15
|
||||||
VERSION_MAJOR=2
|
VERSION_MAJOR=3
|
||||||
VERSION_MINOR=0
|
VERSION_MINOR=0
|
||||||
|
|
||||||
## Start of generic script part
|
## Start of generic script part
|
||||||
@@ -68,25 +68,27 @@ helpSequencer() {
|
|||||||
Usage: $SEQ_NAME [OPTIONS] [STEP NUMBER(s) or ALIAS] [STEP ARGUMENTS]
|
Usage: $SEQ_NAME [OPTIONS] [STEP NUMBER(s) or ALIAS] [STEP ARGUMENTS]
|
||||||
|
|
||||||
[OPTIONS]
|
[OPTIONS]
|
||||||
--all, -a : Run all steps regardless of continuity
|
--all, -a : Run all steps regardless of continuity
|
||||||
--config, -c : Open sequence configuration file (also sets -qq)
|
--config, -c : Open sequence configuration file (also sets -qq)
|
||||||
--dry-run, -d : Only print to console what would be done
|
--dry-run, -d : Only print to console what would be done
|
||||||
! Attention - Sequence must support this
|
! Attention - Sequence must support this
|
||||||
--help, -h : Display help
|
--help, -h : Display help
|
||||||
--helpapi, -ha : Display help about build-in supporting functions
|
--helpapi, -ha : Display help about build-in supporting functions
|
||||||
(e.g. exe,addconf,echerr,...)
|
(e.g. exe,addconf,echerr,...)
|
||||||
--liststeps, -ls : List all step numbers and alias
|
--liststeps, -ls : List all step numbers and alias
|
||||||
--profile, -p : Sequence configuration profile name (default: "default")
|
--profile, -p : Sequence configuration profile name (default: "default")
|
||||||
(if supported by sequence)
|
(if supported by sequence)
|
||||||
-pl : List available profiles
|
-pl : List available profiles
|
||||||
--quiet, -q : Don't ask for permission to execute steps
|
--quiet, -q : Don't ask for permission to execute steps
|
||||||
If called without starting step number, only this help is shown
|
If called without starting step number, only this help is shown
|
||||||
-qq : Same as --quiet but suppresses regular sequencer.sh output
|
-qq : Same as --quiet but suppresses regular sequencer.sh output
|
||||||
--single, -s : Execute only one step
|
--single, -s : Execute only one step
|
||||||
If more than one step is requested, only the first will be executed
|
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)
|
--verbose, -v : Verbose output (use exe() function to call shell commands in seqs)
|
||||||
( e.g.: exe apt update )
|
( e.g.: exe apt update )
|
||||||
--version : Display version of sequencer and revision of sequence
|
--version : Display version of sequencer and revision of sequence
|
||||||
|
-- : End options marker
|
||||||
|
++ : Quick start step 1 (-qq) and skipping [STEP NUMBER(s) or ALIAS]
|
||||||
|
|
||||||
[STEP NUMBER"(s)" 1-${MAX_STEP} or ALIAS]
|
[STEP NUMBER"(s)" 1-${MAX_STEP} or ALIAS]
|
||||||
No STEP or ALIAS : assume 1 as starting point
|
No STEP or ALIAS : assume 1 as starting point
|
||||||
@@ -928,8 +930,8 @@ createTemplate() {
|
|||||||
toolName=mytool
|
toolName=mytool
|
||||||
|
|
||||||
# Get script working directory
|
# Get script working directory
|
||||||
# (when called from a different directory)
|
# (when called from a different directory and even when called via symlink)
|
||||||
WDIR="\$(cd "\$(dirname "\${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)"
|
WDIR="\$(cd "\$(dirname -- "\$(realpath \${BASH_SOURCE[0]})")" >>/dev/null 2>&1 && pwd)"
|
||||||
APTOPT=
|
APTOPT=
|
||||||
CONFIG=0
|
CONFIG=0
|
||||||
SCRIPT_FILE=\$(basename -- \$0)
|
SCRIPT_FILE=\$(basename -- \$0)
|
||||||
@@ -942,11 +944,11 @@ step_config() {
|
|||||||
## e.g. to source a config file manually:
|
## e.g. to source a config file manually:
|
||||||
#. "\$CONFIG_FILE"
|
#. "\$CONFIG_FILE"
|
||||||
|
|
||||||
## or to use sequencer api with global config file:
|
|
||||||
#initSeqConfig "\$CONFIG_FILE_NAME" "\$CONFIG_FILE_TEMPLATE"
|
|
||||||
|
|
||||||
## or to use sequencer api with profile config file support:
|
## or to use sequencer api with profile config file support:
|
||||||
#initSeqConfig -p "\$SCRIPT_NAME" "\$CONFIG_FILE_TEMPLATE"
|
#initSeqConfig -p "\$SCRIPT_NAME" "\$CONFIG_FILE_TEMPLATE"
|
||||||
|
|
||||||
|
## or to use sequencer api with global config file:
|
||||||
|
#initSeqConfig "\$CONFIG_FILE_NAME" "\$CONFIG_FILE_TEMPLATE"
|
||||||
#if [ \$? -eq 0 ] ; then
|
#if [ \$? -eq 0 ] ; then
|
||||||
# CONFIG=1
|
# CONFIG=1
|
||||||
#else
|
#else
|
||||||
@@ -961,7 +963,7 @@ step_config() {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
step_1_info() { echo "My custom step"; }
|
step_1_info() { echoinfoArgs "[OPTIONS]"; echo "My custom step"; }
|
||||||
step_1_alias() { ALIAS="begin"; }
|
step_1_alias() { ALIAS="begin"; }
|
||||||
step_1() {
|
step_1() {
|
||||||
echo "Doing something for step \$1 ..."
|
echo "Doing something for step \$1 ..."
|
||||||
@@ -969,7 +971,7 @@ step_1() {
|
|||||||
# Use exe for regular command
|
# Use exe for regular command
|
||||||
# Use exep "command" for commands containing pipes or redirects
|
# Use exep "command" for commands containing pipes or redirects
|
||||||
exe ls
|
exe ls
|
||||||
exep "dmesg | grep usb"
|
exep "dmesg | head"
|
||||||
}
|
}
|
||||||
|
|
||||||
VERSION_SEQREV=${VERSION_REV}
|
VERSION_SEQREV=${VERSION_REV}
|
||||||
@@ -1203,10 +1205,17 @@ main() {
|
|||||||
local STARTALL
|
local STARTALL
|
||||||
local EMPTYCALL=1
|
local EMPTYCALL=1
|
||||||
local quietSave=
|
local quietSave=
|
||||||
|
local quickStartOne=0
|
||||||
|
|
||||||
# options check
|
# options check
|
||||||
for arg in "$@" ; do
|
for arg in "$@" ; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
++) # end parameter and quickstart step 1 with -qq
|
||||||
|
quickStartOne=1
|
||||||
|
QUIET=2
|
||||||
|
shift && break;;
|
||||||
|
--) # end parameter
|
||||||
|
shift && break;;
|
||||||
--all|-a) # execute all steps; regardless continouity
|
--all|-a) # execute all steps; regardless continouity
|
||||||
STARTALL="-a"
|
STARTALL="-a"
|
||||||
shift;;
|
shift;;
|
||||||
@@ -1262,13 +1271,17 @@ main() {
|
|||||||
# Don't show help if only configuration should be edited
|
# Don't show help if only configuration should be edited
|
||||||
[ $SEQ_CONFIG_EDIT -ne 0 ] && [ -z "$1" ] && QUIET=2
|
[ $SEQ_CONFIG_EDIT -ne 0 ] && [ -z "$1" ] && QUIET=2
|
||||||
|
|
||||||
if [ -z "$1" ] ; then
|
if [ -z "$1" ] && [ $quickStartOne -eq 0 ] ; then
|
||||||
if [ $QUIET -eq 0 ] ; then
|
if [ $QUIET -eq 0 ] ; then
|
||||||
# Empty -> show help
|
# Empty -> show help
|
||||||
displayHelp
|
displayHelp
|
||||||
fi
|
fi
|
||||||
# Assume starting at one for interactive mode
|
# Assume starting at one for interactive mode
|
||||||
START=1
|
START=1
|
||||||
|
elif [ $quickStartOne -ne 0 ] ; then
|
||||||
|
EMPTYCALL=0
|
||||||
|
START=1
|
||||||
|
STEP_ARGS=( "$@" )
|
||||||
else
|
else
|
||||||
EMPTYCALL=0
|
EMPTYCALL=0
|
||||||
read -r -a START <<< "$1"
|
read -r -a START <<< "$1"
|
||||||
|
@@ -13,6 +13,7 @@ _sqnall_completions()
|
|||||||
case "$cur" in
|
case "$cur" in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W '\
|
COMPREPLY=( $( compgen -W '\
|
||||||
|
-- \
|
||||||
-a --all \
|
-a --all \
|
||||||
-c --config \
|
-c --config \
|
||||||
-d --dry-run \
|
-d --dry-run \
|
||||||
|
Reference in New Issue
Block a user