Skip to content

Commit

Permalink
help for adr generate subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
npryce committed Mar 12, 2017
1 parent 14ae2ca commit 2febf82
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 9 deletions.
25 changes: 25 additions & 0 deletions src/_adr_generate_graph
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@
set -e
eval "$($(dirname $0)/adr-config)"

## usage: adr generate graph [-e LINK-EXTENSION]
##
## Generates a visualisation of the links between decision records in
## Graphviz format. This can be piped into the graphviz tools to
## generate a an image file.
##
## Each node in the graph represents a decision record and is linked to
## the decision record document.
##
## Options:
##
## -e LINK-EXTENSION
## The file extension of the documents to which generated links refer.
## Defaults to `.html`.
##
## E.g. to generate a graph visualisation of decision records in SVG format:
##
## adr generate graph | dot -Tsvg > graph.svg
##
## E.g. to generate a graph visualisation in PDF format, in which all links
## are to .pdf files:
##
## adr generate graph -e .pdf | dot -Tpdf > graph.pdf


link_extension=.html

while getopts e: arg
Expand Down
11 changes: 11 additions & 0 deletions src/_adr_generate_toc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
set -e
eval "$($(dirname $0)/adr-config)"

## usage: adr generate toc [-i INTRO] [-o OUTRO]
##
## Generates a table of contents in Markdown format to stdout.
##
## Options:
##
## -e INTRO precede the table of contents with the given INTRO text.
## -o OUTRO follow the table of contents with the given OUTRO text.
##
## Both INTRO and OUTRO must be in Markdown format.

args=$(getopt i:o: $*)
set -- $args

Expand Down
3 changes: 1 addition & 2 deletions src/adr-generate
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ eval "$($(dirname $0)/adr-config)"

## usage: adr generate [REPORT [OPTION ...]]
##
## Generates summary documentation about the architecture decision records
## in Markdown format.
## Generates summary documentation about the architecture decision records.
##
## The command `adr generate` lists the types of report.

Expand Down
21 changes: 14 additions & 7 deletions src/adr-help
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@
set -e
eval "$($(dirname $0)/adr-config)"

## usage: adr help [COMMAND]
## usage: adr help [COMMAND [SUBCOMMAND...]]
##
## If COMMAND is given, displays help for that command. Otherwise lists
## the available commands.
## If COMMAND and any SUBCOMMANDs are given, displays help for that command.
## Otherwise lists the available commands.

cmd="$1"
cmdexe="$adr_bin_dir/adr-$cmd"
cmds=("$@")

if [ -z "$cmd" -o ! -x $cmdexe ]
if (( ${#@} == 1 ))
then
echo "usage: $0 COMMAND [ARG] ..."
cmdexe="$adr_bin_dir/adr-$1"
elif (( ${#@} > 1 ))
then
cmdexe="$adr_bin_dir/_adr_$(IFS=_; echo "${cmds[*]}")"
fi

if [ -z "$cmds" -o ! -x "$cmdexe" ]
then
echo "usage: adr help COMMAND [ARG] ..."
echo "COMMAND is one of: "
$adr_bin_dir/_adr_commands | sed 's/^/ /'
echo "Run 'adr help COMMAND' for help on a specific command."
Expand Down

0 comments on commit 2febf82

Please sign in to comment.