Don't ask for template creation if sequencer.sh was called directly with -h
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
VERSION_REV=10
|
||||
VERSION_MAJOR=0
|
||||
VERSION_MINOR=0
|
||||
VERSION_MINOR=1
|
||||
|
||||
## Start of generic script part
|
||||
|
||||
@@ -687,12 +687,21 @@ parseAlias() {
|
||||
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
|
||||
displayHelp() {
|
||||
local createTemplate=1
|
||||
local stepsFound=0
|
||||
CONTEXT_HELP=1
|
||||
helpSequencer
|
||||
|
||||
if [ ! -z $1 ] && [ $1 -eq 1 ] ; then
|
||||
createTemplate=0
|
||||
fi
|
||||
|
||||
# check if step definition exists by looking for a step_*() function
|
||||
for ((i=1; i<=${MAX_STEP}; i++)); do
|
||||
existsFunction step_${i}
|
||||
@@ -705,20 +714,22 @@ displayHelp() {
|
||||
if [ $stepsFound -eq 0 ] ; then
|
||||
echo -e "\n It seems ${0##*/} was called directly."
|
||||
echo -e " Please create a sequence script first.\n"
|
||||
read -p " Create a template now? y/[n]? " answer
|
||||
case $answer in
|
||||
[yY])
|
||||
createTemplate
|
||||
if [ $? -eq 0 ] ; then
|
||||
echo -e "\n $TEMPLATE_NAME created."
|
||||
else
|
||||
echo -e "\n $TEMPLATE_NAME exists...Nothing to do!"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo -e "\n Nothing to do!"
|
||||
;;
|
||||
esac
|
||||
if [ $createTemplate -ne 0 ] ; then
|
||||
read -p " Create a template now? y/[n]? " answer
|
||||
case $answer in
|
||||
[yY])
|
||||
createTemplate
|
||||
if [ $? -eq 0 ] ; then
|
||||
echo -e "\n $TEMPLATE_NAME created."
|
||||
else
|
||||
echo -e "\n $TEMPLATE_NAME exists...Nothing to do!"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo -e "\n Nothing to do!"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
exit 1;
|
||||
else
|
||||
echo -e "\n Step (= alias) documentation:"
|
||||
@@ -805,7 +816,7 @@ main() {
|
||||
shift
|
||||
;;
|
||||
--help|-h) # show only help
|
||||
displayHelp
|
||||
displayHelp 1
|
||||
exit 0;
|
||||
;;
|
||||
--helpapi|-ha) #show build-in functions
|
||||
|
Reference in New Issue
Block a user