Skip to content

Commit 651119c

Browse files
committed
help command lists subcommands, where appropriate
1 parent 2febf82 commit 651119c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/adr-generate

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ eval "$($(dirname $0)/adr-config)"
55
## usage: adr generate [REPORT [OPTION ...]]
66
##
77
## Generates summary documentation about the architecture decision records.
8-
##
9-
## The command `adr generate` lists the types of report.
108

119
cmd=$1
1210

src/adr-help

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,17 @@ then
2525
echo "Run 'adr help COMMAND' for help on a specific command."
2626
else
2727
grep -E '^##' "$cmdexe" | cut -c 4-
28+
29+
# Assumes only two levels of command / subcommand.
30+
subcmds=( $(compgen -G "$adr_bin_dir/_adr_$1_"'*') )
31+
32+
if (( ${#subcmds} > 0 ))
33+
then
34+
echo
35+
echo Subcommands:
36+
for f in "${subcmds[@]}"
37+
do
38+
basename $f | cut -c $(( ${#1} + 7 ))-
39+
done | sed "s/^/ adr $1 /"
40+
fi
2841
fi

0 commit comments

Comments
 (0)