Refactor helper script

This commit is contained in:
Jakob Schöttl 2019-01-10 19:13:28 +01:00 committed by Simon Michael
parent e5134db9a4
commit 78d08455c0
2 changed files with 4 additions and 9 deletions

View File

@ -7,7 +7,7 @@ generic-options.txt:
hledger -h | ./output-options.sh > $@
commands.txt:
hledger | ./output-commands.sh > $@
hledger | ./output-commands.sh | grep -v ^hledger > $@
commands-list.txt: commands.txt
paste -sd, $^ | tr -d '\n' > $@

View File

@ -3,19 +3,14 @@
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
sed -rn 's/^ ([-a-z]+).*/\1/gp' "$tmp"
sed -rn 's/^ .*\(([a-z]+)\).*/\1/gp' "$tmp"
# TODO missing: (reg, r) (multiple aliases)
}
main "$@"