Skip to content
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

Open
casey opened this issue Sep 24, 2019 · 5 comments
Open

Add flags and options #476

casey opened this issue Sep 24, 2019 · 5 comments

Comments

@casey
Copy link
Owner

casey commented Sep 24, 2019

Recipes should be able to define options:

foo --bar BAZ:
  echo {{BAZ}}

Maybe flags too:

foo --BAZ:
  echo {{BAZ}} # is it "true" or "false"? Or "" or BAZ?

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.

@casey casey modified the milestones: eventually, 1.0 Sep 24, 2019
@casey casey modified the milestones: 1.0, eventually Nov 7, 2019
@casey
Copy link
Owner Author

casey commented Nov 11, 2019

It occurs to me that we could use clap to construct recipe argument parsers.

@casey casey removed this from the eventually milestone Jul 2, 2020
@hustcer
Copy link
Contributor

hustcer commented Sep 16, 2021

@casey Will flags be supported ? It's a quite common use case , Thanks !

@hustcer
Copy link
Contributor

hustcer commented Sep 16, 2021

flag shorthand can also be supported:
foo --bar(-b):

@sascha-wolf
Copy link

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}}
$ just foo bar=stuff
stuff

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}}
$ just watch cmd='<some other command>'

@colemannerd
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants