Exit build with an error if unable to parse hledger sub-commands

This commit is contained in:
Vladimir Zhelezov 2020-12-19 09:13:00 +01:00
parent ac143aff6b
commit 62c3c8e6da
2 changed files with 6 additions and 1 deletions

View File

@ -27,6 +27,11 @@ EXTENSIONS := ui web
INSTALLED_EXTENSIONS := $(foreach EXT,$(EXTENSIONS),$(shell type hledger-$(EXT) >/dev/null 2>&1 && echo $(EXT))) INSTALLED_EXTENSIONS := $(foreach EXT,$(EXTENSIONS),$(shell type hledger-$(EXT) >/dev/null 2>&1 && echo $(EXT)))
COMMANDS := $(sort $(shell $(PARSE_COMMANDS)) $(INSTALLED_EXTENSIONS)) COMMANDS := $(sort $(shell $(PARSE_COMMANDS)) $(INSTALLED_EXTENSIONS))
ifneq ($(.SHELLSTATUS),0)
$(error Error running $(PARSE_COMMANDS))
endif
CMDOPTFILES := $(foreach CMD,$(COMMANDS),options-$(CMD).txt) CMDOPTFILES := $(foreach CMD,$(COMMANDS),options-$(CMD).txt)
all: hledger-completion.bash all: hledger-completion.bash

View File

@ -4,7 +4,7 @@
set -uo pipefail set -uo pipefail
declare commands_help declare commands_help
commands_help=$(hledger) commands_help=$(hledger) || exit
{ {
sed -rn 's/^\s+([a-z][-a-z]+)\s+.*/\1/p' <<< "$commands_help" sed -rn 's/^\s+([a-z][-a-z]+)\s+.*/\1/p' <<< "$commands_help"
sed -rn 's/^\s+[a-z][-a-z]+\s+\(([a-z][ ,a-z]+)\).*/\1/p' <<< "$commands_help" | sed -rn 's/^\s+[a-z][-a-z]+\s+\(([a-z][ ,a-z]+)\).*/\1/p' <<< "$commands_help" |