Improved separation of step cluster for the help output

This commit is contained in:
2022-01-23 22:38:57 +01:00
parent b6e4359965
commit 38d635446e

View File

@@ -9,7 +9,7 @@
VERSION_REV=14 VERSION_REV=14
VERSION_MAJOR=0 VERSION_MAJOR=0
VERSION_MINOR=0 VERSION_MINOR=1
## Start of generic script part ## Start of generic script part
@@ -950,7 +950,7 @@ displayHelp() {
local clusterSize=0 local clusterSize=0
local lastClusterSize=0 local lastClusterSize=0
local createTemplate=1 local createTemplate=1
local stepsFound=0 local stepFound=0
local loopStart=0 local loopStart=0
local loopEnd=${MAX_STEP} local loopEnd=${MAX_STEP}
CONTEXT_HELP=1 CONTEXT_HELP=1
@@ -980,10 +980,11 @@ displayHelp() {
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
continue continue
fi fi
stepsFound=1 stepFound=$i
break
done done
if [ $stepsFound -eq 0 ] ; then if [ $stepFound -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 if [ $createTemplate -ne 0 ] ; then
@@ -1011,6 +1012,7 @@ displayHelp() {
existsFunction step_${i} existsFunction step_${i}
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
if [ $clusterSize -ne 0 ] ; then if [ $clusterSize -ne 0 ] ; then
# Mark the end of a cluster
lastClusterSize=$clusterSize lastClusterSize=$clusterSize
clusterSize=0 clusterSize=0
fi fi
@@ -1018,8 +1020,13 @@ displayHelp() {
fi fi
((clusterSize+=1)) ((clusterSize+=1))
if [ $lastClusterSize -gt 1 ] ; then if [ $lastClusterSize -gt 1 ] ; then
# Add separation at the end of a cluster
lastClusterSize=0 lastClusterSize=0
echo echo
elif [ $clusterSize -eq 1 ]; then
# Add separation before the start of a cluster if it is not the first
existsFunction step_$((i+1))
[ $? -eq 0 ] && [ $i -ne $stepFound ] && echo
fi fi
printf ' Step %3s ' $i printf ' Step %3s ' $i