Skip to content

Commit

Permalink
help command lists subcommands, where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
npryce committed Mar 12, 2017
1 parent 2febf82 commit 651119c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/adr-generate
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ eval "$($(dirname $0)/adr-config)"
## usage: adr generate [REPORT [OPTION ...]]
##
## Generates summary documentation about the architecture decision records.
##
## The command `adr generate` lists the types of report.

cmd=$1

Expand Down
13 changes: 13 additions & 0 deletions src/adr-help
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,17 @@ then
echo "Run 'adr help COMMAND' for help on a specific command."
else
grep -E '^##' "$cmdexe" | cut -c 4-

# Assumes only two levels of command / subcommand.
subcmds=( $(compgen -G "$adr_bin_dir/_adr_$1_"'*') )

if (( ${#subcmds} > 0 ))
then
echo
echo Subcommands:
for f in "${subcmds[@]}"
do
basename $f | cut -c $(( ${#1} + 7 ))-
done | sed "s/^/ adr $1 /"
fi
fi

0 comments on commit 651119c

Please sign in to comment.