Do not required step_1 to exist to output step help

This commit is contained in:
2019-10-09 21:37:10 +02:00
parent a365260995
commit 519bc7aa92

View File

@@ -42,7 +42,6 @@ helpSequencer() {
echo " execute only one step with using special step 0"
echo " ( e.g. only execute step 4: $0 \"4 0\" )"
echo " multiple steps need to be given as string"
echo
echo " [STEP ARGUMENTS]"
echo " * : Arguments will be passed to selected steps as:"
echo " \$2 ..."
@@ -329,12 +328,19 @@ parseAlias() {
# Always display sequencer help and, if available, sequence help
displayHelp() {
local stepsFound=0
helpSequencer
# check if step definition exists by looking for step_1()
existsFunction step_1
if [ $? -ne 0 ] ; then
# check if step definition exists by looking for a step_*() function
for ((i=1; i<=${MAX_STEP}; i++)); do
existsFunction step_${i}
if [ $? -ne 0 ] ; then
continue
fi
stepsFound=1
done
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(default)? " answer
@@ -353,7 +359,7 @@ displayHelp() {
esac
exit 1;
else
echo " Step (= alias) documentation:"
echo -e "\n Step (= alias) documentation:"
for ((i=1; i<=${MAX_STEP}; i++)); do
# Display step reference in help if step function exists