Most of the included files are meant to be output literally, without any
macro processing. Using `undivert` in place of `include` achieves that.
This is a safety net against unsanitized input generated during the
build. Also, developers editing the shell code stub shouldn't be
constantly alert about triggering accidental macro expansion.
In order that `undivert` mimics GNU behaviour on BSDs, the `-g` flag is
used for the m4 invocation.
Install the symlinks unconditionally. This way the user don't need
to reinstall completion after adding an extension. Of course fine-
grained control is possible with: `make install EXTENSIONS=web` e.g.
It is not a substitute for proper error checking, it can easily cause
more trouble than good and it would be a burden for contributors and a
source for potential misbehavior. See this take on the topic for
example: http://mywiki.wooledge.org/BashFAQ/105
A `make clean` before commit removes hledger-completion.bash and
it is supposed to be in the repository. `make clean` removes build
artifacts while keeping the latter. Do a `make clean-all` to purge
everything.
It is just a pipe of sed regex filters and all can be viewed/edited
in one place. Add a couple of debug targets to see easily the
effects of regex changes.
This way we can easily edit m4 in m4-mode and the shell script stub
in sh-mode and prevent subtle errors coming from accidental quoting
issues or macros (mis)interpreted by m4.
Make `command-options` a prerequisite of `hledger-completion.bash`.
Currently the build succeeds only because the former takes less time
to finish than all the prerequisites of the latter. If you run a
`make clean && make -j 4`, the build would fail as they are built
in parallel.
Get rid of manually listing unhandled long options:
Instead of listing options requiring an argument one by one in the
case statement in _hledger_compreply_optarg(), the option completion
lists are searched and if the option does require an argument an
empty COMPREPLY is send. Short options are uncounted for and still
need a manual entry.
This necessitated setting $subcommandOptions beforehand, so it is
moved back where it was -- in the sub-command loop in main().
Similarly to long options treatment, suspend space only when
completing what looks like a query or account prefix i.e. something
ending with a colon (:).
Match only lines starting with white space because there are a lot
of option like strings in the discussion section that follows that
are not necessarily what we are after.
Make it obvious that the option expects an argument by appending
the equal sign on completion. Suspend space in this case. The
regular expression in `output-options.sh` is adjusted to take into
account this on processing option strings.