Don't ask for template creation if sequencer.sh was called directly with -h

This commit is contained in:
2020-01-24 19:45:11 +01:00
parent a26a0db9ca
commit cc9fd79693

View File

@@ -9,7 +9,7 @@
VERSION_REV=10 VERSION_REV=10
VERSION_MAJOR=0 VERSION_MAJOR=0
VERSION_MINOR=0 VERSION_MINOR=1
## Start of generic script part ## Start of generic script part
@@ -687,12 +687,21 @@ parseAlias() {
done done
} }
# displayHelp [NO TEMPLATE]
# [NO TEMPLATE]
# 0 (default) : Ask for template creation
# 1 : Do not ask for template creation
# Always display sequencer help and, if available, sequence help # Always display sequencer help and, if available, sequence help
displayHelp() { displayHelp() {
local createTemplate=1
local stepsFound=0 local stepsFound=0
CONTEXT_HELP=1 CONTEXT_HELP=1
helpSequencer helpSequencer
if [ ! -z $1 ] && [ $1 -eq 1 ] ; then
createTemplate=0
fi
# check if step definition exists by looking for a step_*() function # check if step definition exists by looking for a step_*() function
for ((i=1; i<=${MAX_STEP}; i++)); do for ((i=1; i<=${MAX_STEP}; i++)); do
existsFunction step_${i} existsFunction step_${i}
@@ -705,6 +714,7 @@ displayHelp() {
if [ $stepsFound -eq 0 ] ; then if [ $stepsFound -eq 0 ] ; then
echo -e "\n It seems ${0##*/} was called directly." echo -e "\n It seems ${0##*/} was called directly."
echo -e " Please create a sequence script first.\n" echo -e " Please create a sequence script first.\n"
if [ $createTemplate -ne 0 ] ; then
read -p " Create a template now? y/[n]? " answer read -p " Create a template now? y/[n]? " answer
case $answer in case $answer in
[yY]) [yY])
@@ -719,6 +729,7 @@ displayHelp() {
echo -e "\n Nothing to do!" echo -e "\n Nothing to do!"
;; ;;
esac esac
fi
exit 1; exit 1;
else else
echo -e "\n Step (= alias) documentation:" echo -e "\n Step (= alias) documentation:"
@@ -805,7 +816,7 @@ main() {
shift shift
;; ;;
--help|-h) # show only help --help|-h) # show only help
displayHelp displayHelp 1
exit 0; exit 0;
;; ;;
--helpapi|-ha) #show build-in functions --helpapi|-ha) #show build-in functions