Replies: 1 comment 6 replies
-
You can do this with: (cli/dispatch
[{:cmds ["run" "job"]
:fn run-job
:spec {:paths {:coerce :string :default "foo/bar"}}
:args->opts [:job]}] ...args) All options in a subcommand entry are merged. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone,
I stumbled into the following situation: I'm trying to build a simple command line interface to run jobs that accepts commands in the form of
Thus far this is easy to implement using the Subcommand mechanism build in bb-cli i.e.
In my usecase, every job has its own unique set of additional options. I.e. jobA takes the option
--path "/some/path"
and jobB takes--depth 2
.What I'm looking for is a way to delegate the job specific options down to the function that runs the specific job and use the cli spec and coercion mechanism there to parse and coerce the job's options. I.e. something like this:
Of cause the
args
that are passed down tojobA
by thedispatch
function above are a map with the command line arguments already parsed. Since the function that contains the dispatch does not now the spec down in jobA, the coercion might be wrong.Is there a build in mechanism I can pass down the original
*command-line-args*
and parse them in the job specific function? Or another mechanism to do what I would like to achieve? (except from using*command-line-args*
inside the job function)Beta Was this translation helpful? Give feedback.
All reactions