Skip to content

Conversation

@NickleDave
Copy link
Collaborator

No description provided.

NickleDave and others added 30 commits September 12, 2025 16:20
To add a `configfile` command,
we can no longer assume that we have just
two arguments, `command` and `configfile`.

Instead we need to move to sub-parsers,
even though must of the sub-parsers
will just be the same named commands as before,
and will only have a single positional argument
of `configfile`.
As of now, only the new `configfile` command will
be different, although I haven't figured out
what its args will be yet.

To do this I ended up representing
cli commands as a dataclass inside the
`vak.cli.cli` module,
with attributes `name`, `help`,
`func`, and `add_parser_args_func`.

I am choosing to send each sub-parser
to `dest='command'`, and then dispatching
based on the value of `command` inside the
`vak.cli.cli.cli` function, instead of letting
`argparse` do all the work,
because I want to be able to raise a
somewhat friendly error message.
Maybe this is not needed since argparse
validates arguments anyways.
But this requires the least rewiring of
what we already had in place.
…itle+description so we get more info from parser.print_help
… typehints args parameter as arpgarse.Namespace, and spell out pathlib.Path instead of importing Path from pathlib
…test that calling 'vak' without args results in parser.print_help()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants