diff options
author | Justus Winter <justus@pep-project.org> | 2018-01-04 16:33:43 +0100 |
---|---|---|
committer | Justus Winter <justus@pep-project.org> | 2018-01-04 16:33:43 +0100 |
commit | d639f0b77b742b4eda4aeacb5db72d26e68ec227 (patch) | |
tree | d8e5ea2a453adfda6c2bb47adc0d86022ebc28bb /tool/make-usage.sh | |
parent | 49d10c39ab85d54d440b57522fcfdcce13f9af3f (diff) |
tool: Implement keyserver interactions.
- Implement retrieving and sending keys.
- Improve usage generation to include nested subcommands.
Diffstat (limited to 'tool/make-usage.sh')
-rw-r--r-- | tool/make-usage.sh | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/tool/make-usage.sh b/tool/make-usage.sh index bc150a75..c9c890a2 100644 --- a/tool/make-usage.sh +++ b/tool/make-usage.sh @@ -1,5 +1,7 @@ #!/bin/sh +sq=$1 + quote() { sed 's@^@//! @' | sed 's/ $//' } @@ -12,30 +14,40 @@ end_code() { printf '```\n' } -( - printf "A command-line frontend for Sequoia. +dump_help() { # subcommand, indention + if [ -z "$1" ] + then + printf "\n# Usage\n\n" + set "" "#" + else + printf "\n$2 Subcommand$1\n\n" + fi -# Usage + help="`$sq $1 --help`" -" begin_code - sq --help + printf "$help\n" | tail -n +2 end_code - sq --help | - sed -n '/^SUBCOMMANDS:/,$p' | - tail -n+2 | - while read command desc - do - if [ "$command" = help ]; then - continue - fi - - printf "\n## Subcommand $command\n\n" - begin_code - sq $command --help - end_code - done + if echo $help | fgrep -q SUBCOMMANDS + then + printf "$help\n" | + sed -n '/^SUBCOMMANDS:/,$p' | + tail -n+2 | + while read subcommand desc + do + if [ "$subcommand" = help ]; then + continue + fi + + dump_help "$1 $subcommand" "#$2" + done + fi +} + +( + printf "A command-line frontend for Sequoia.\n" + dump_help ) | quote printf '\ninclude!("main.rs");\n' |