-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flags and options #476
Comments
It occurs to me that we could use clap to construct recipe argument parsers. |
@casey Will flags be supported ? It's a quite common use case , Thanks ! |
flag shorthand can also be supported: |
Just my two cents: I would already be super happy if I could explicitly refer to the argument's name: foo bar=something:
echo {{bar}}
Of course fully featured flags and options would be lovely but for my personal use-case (and I imagine other's as well) this would already be very helpful, because then I can do things like this: watch folders='lib,test' cmd='just test':
find {{ '{' }}{{folders}}{{ '}' }} -name '*.ex*' | entr -dc {{cmd}}
|
I've just started using Just and my org loves it! One thing that would improve our usage is opts with enums. We use just to coordinate all of our environment scripts and so we have done things like standardize accounts or environments to a certain list. Right now, they're just strings that we then call a pre-recipe on to check that they are one of a list. It would be awesome if we had this functionality AND incorporaitng an enum for one of the opts. I know #1990 is also similar. |
Any hope for this feature? |
I'm not currently working on it. It's pretty complex, but it is a good feature. |
Would definitely love this capability. Right now you can use env vars as named parameters
But it would be great if the arguments could be first class citizens of just (with default values if omitted) because they are discoverable with For example:
I guess one concern with this is distinguishing what arguments/flags are for For instance:
Perhaps explicitly named arguments can be excluded from run --profile="release" --os="{{ os() }}" --arch="{{ arch() }}" ...ARGS:
cargo build --profile {{ profile }} --target {{ os }}-{{ arch }}
./target/{{ profile }}/main {{ ARGS }} Which executes: cargo build --profile release --target macos-amd64
./target/release/main --foo --bar 42 |
One way I've seen that handled in some other tools is to use So for your example, it would look something like just run --profile release --os linux --arch amd64 -- --foo --bar 42 Not sure how hard that would be to implement or if it would work here, just thought I'd mention it as some prior art. |
Recipes should be able to define options:
Maybe flags too:
Large changes to the parsing of recipe parameters like this should be considered holistically, along with other possible changes, like
$
to support exporting parameters as environment variables, or changing all just variables to being environment variables.The text was updated successfully, but these errors were encountered: