mirror of
https://github.com/simonmichael/hledger.git
synced 2025-01-04 00:07:29 +03:00
22 lines
391 B
Bash
22 lines
391 B
Bash
|
#!/bin/bash
|
||
|
# Output subcommands from man/usage text
|
||
|
|
||
|
set -o errexit -o pipefail -o nounset
|
||
|
|
||
|
printCommands() {
|
||
|
declare tmp=$1
|
||
|
sed -rn 's/^ ([-a-z]+).*/\1/gp' "$tmp"
|
||
|
sed -rn 's/^ .*\(([a-z]+)\).*/\1/gp' "$tmp"
|
||
|
# TODO missing: (reg, r) (multiple aliases)
|
||
|
}
|
||
|
|
||
|
main() {
|
||
|
declare tmp
|
||
|
tmp=$(mktemp)
|
||
|
cat > "$tmp"
|
||
|
|
||
|
printCommands "$tmp" | grep -v ^hledger
|
||
|
}
|
||
|
|
||
|
main "$@"
|