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_MAJOR=0
VERSION_MINOR=0
VERSION_MINOR=1
## Start of generic script part
@@ -950,7 +950,7 @@ displayHelp() {
local clusterSize=0
local lastClusterSize=0
local createTemplate=1
local stepsFound=0
local stepFound=0
local loopStart=0
local loopEnd=${MAX_STEP}
CONTEXT_HELP=1
@@ -980,10 +980,11 @@ displayHelp() {
if [ $? -ne 0 ] ; then
continue
fi
stepsFound=1
stepFound=$i
break
done
if [ $stepsFound -eq 0 ] ; then
if [ $stepFound -eq 0 ] ; then
echo -e "\n It seems ${0##*/} was called directly."
echo -e " Please create a sequence script first.\n"
if [ $createTemplate -ne 0 ] ; then
@@ -1011,6 +1012,7 @@ displayHelp() {
existsFunction step_${i}
if [ $? -ne 0 ] ; then
if [ $clusterSize -ne 0 ] ; then
# Mark the end of a cluster
lastClusterSize=$clusterSize
clusterSize=0
fi
@@ -1018,8 +1020,13 @@ displayHelp() {
fi
((clusterSize+=1))
if [ $lastClusterSize -gt 1 ] ; then
# Add separation at the end of a cluster
lastClusterSize=0
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
printf ' Step %3s ' $i