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