Closed ehllie closed 2 years ago
Adding support for command line completion would be great, is there any way we can do it without changing the default of ante run ...
though?
I went for separating the cli into sub-commands, to clearly differentiate between which options are compatible with one another, but it should also be possible to achieve with argument relations
This is what I have so far
I can alternatively try doing something like this:
build
, delete-binary
, show-hir
, show-ir
, backend
and opt_level
flags and options into a codegen args structbuild
and delete-binary
flags mutually exclusive in that structcheck
flag mutually exclusive with the codegen args fieldsprint-completion
option that's mutually exclusive with all other optionsThat should preserve the current functionality, add some extra check and allow for generating syntax completion.
That sounds better. As far as prioritization goes, I think the most important aspects are (in order):
ante myecho.an this is echoed
.check
and run
. I think most of these should be fairly obvious to users that they are conflicting, but an explicit error would always be nice.This PR is a little more conservative now.
Cli
to avoid conflicts with clap::Args
ante --shell-completion <shell>
lex
parse
check
or build
at the same time
Ideas for changes so far
Overhauling the cli by splitting the functionality into 3 sub-commands:
check
: Equivalent ofante --check
and has options for printing out the result of each step before codegen.build
: Equivalent ofante --build
and has the options for configuring the backend and optimisation level.run
: The current defaultante
, has the same options asbuild
, but also one to delete the binary afterwards.Additionally, a new functionality inside the sub-command
completions
which just allows for automatically generating code completion scripts withclap_complete
135