sequencer - new options -- (end options) ++ (quick start step 1)
Update template
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
## Version information
|
||||
|
||||
VERSION_REV=15
|
||||
VERSION_MAJOR=2
|
||||
VERSION_MAJOR=3
|
||||
VERSION_MINOR=0
|
||||
|
||||
## Start of generic script part
|
||||
@@ -68,25 +68,27 @@ helpSequencer() {
|
||||
Usage: $SEQ_NAME [OPTIONS] [STEP NUMBER(s) or ALIAS] [STEP ARGUMENTS]
|
||||
|
||||
[OPTIONS]
|
||||
--all, -a : Run all steps regardless of continuity
|
||||
--config, -c : Open sequence configuration file (also sets -qq)
|
||||
--dry-run, -d : Only print to console what would be done
|
||||
--all, -a : Run all steps regardless of continuity
|
||||
--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
|
||||
--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")
|
||||
--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
|
||||
-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
|
||||
-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)
|
||||
--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
|
||||
-- : End options marker
|
||||
++ : Quick start step 1 (-qq) and skipping [STEP NUMBER(s) or ALIAS]
|
||||
|
||||
[STEP NUMBER"(s)" 1-${MAX_STEP} or ALIAS]
|
||||
No STEP or ALIAS : assume 1 as starting point
|
||||
@@ -928,8 +930,8 @@ createTemplate() {
|
||||
toolName=mytool
|
||||
|
||||
# Get script working directory
|
||||
# (when called from a different directory)
|
||||
WDIR="\$(cd "\$(dirname "\${BASH_SOURCE[0]}")" >>/dev/null 2>&1 && pwd)"
|
||||
# (when called from a different directory and even when called via symlink)
|
||||
WDIR="\$(cd "\$(dirname -- "\$(realpath \${BASH_SOURCE[0]})")" >>/dev/null 2>&1 && pwd)"
|
||||
APTOPT=
|
||||
CONFIG=0
|
||||
SCRIPT_FILE=\$(basename -- \$0)
|
||||
@@ -942,11 +944,11 @@ step_config() {
|
||||
## e.g. to source a config file manually:
|
||||
#. "\$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:
|
||||
#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
|
||||
# CONFIG=1
|
||||
#else
|
||||
@@ -961,7 +963,7 @@ step_config() {
|
||||
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() {
|
||||
echo "Doing something for step \$1 ..."
|
||||
@@ -969,7 +971,7 @@ step_1() {
|
||||
# Use exe for regular command
|
||||
# Use exep "command" for commands containing pipes or redirects
|
||||
exe ls
|
||||
exep "dmesg | grep usb"
|
||||
exep "dmesg | head"
|
||||
}
|
||||
|
||||
VERSION_SEQREV=${VERSION_REV}
|
||||
@@ -1203,10 +1205,17 @@ main() {
|
||||
local STARTALL
|
||||
local EMPTYCALL=1
|
||||
local quietSave=
|
||||
local quickStartOne=0
|
||||
|
||||
# options check
|
||||
for arg in "$@" ; do
|
||||
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
|
||||
STARTALL="-a"
|
||||
shift;;
|
||||
@@ -1262,13 +1271,17 @@ main() {
|
||||
# Don't show help if only configuration should be edited
|
||||
[ $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
|
||||
# Empty -> show help
|
||||
displayHelp
|
||||
fi
|
||||
# Assume starting at one for interactive mode
|
||||
START=1
|
||||
elif [ $quickStartOne -ne 0 ] ; then
|
||||
EMPTYCALL=0
|
||||
START=1
|
||||
STEP_ARGS=( "$@" )
|
||||
else
|
||||
EMPTYCALL=0
|
||||
read -r -a START <<< "$1"
|
||||
|
@@ -13,6 +13,7 @@ _sqnall_completions()
|
||||
case "$cur" in
|
||||
-*)
|
||||
COMPREPLY=( $( compgen -W '\
|
||||
-- \
|
||||
-a --all \
|
||||
-c --config \
|
||||
-d --dry-run \
|
||||
|
Reference in New Issue
Block a user