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 preview and command-line argument support for default chooser #947

Closed
terror opened this issue Aug 13, 2021 · 9 comments
Closed

Add preview and command-line argument support for default chooser #947

terror opened this issue Aug 13, 2021 · 9 comments

Comments

@terror
Copy link
Contributor

terror commented Aug 13, 2021

When --chose is invoked without specifying a chooser, it uses fzf with recipe names present in the projects justfile without a preview window for currently highlighted recipes. If a recipe is selected it invokes just with that recipe name without prompting the user to pass in any command-line arguments.

Consider adding a preview window to display the recipes contents during the search in addition to being able to pass in command-line arguments to recipes that take them.

Here's a rough idea for how this may look like:

asciicast

@casey
Copy link
Owner

casey commented Aug 14, 2021

This is a great idea. I think this should be added once we switch to skim (#939) as the default chooser. It'll be easier to add features to the choosing command if we know for sure what chooser we're invoking.

This will require some tweaks to how the command works. Currently, the choose subcommand can only take recipes, to take arguments, it'll have to invoke the run command.

@Qeole
Copy link
Contributor

Qeole commented Dec 11, 2023

Looks like this was implemented in #1539?

@casey
Copy link
Owner

casey commented Dec 11, 2023

Nice, yup, this can be closed.

@casey casey closed this as completed Dec 11, 2023
@XBagon
Copy link

XBagon commented Jan 14, 2025

Am I missing something? It stills explicitly filters out recipes with arguments, which I don't understand why it does in the first place, as they execute fine if you just type out the argument. (Which requires typing the whole recipe name as well, but at least it supports in finding the recipe)

.filter(|recipe| recipe.min_arguments() == 0),

Also I cannot find the here proposed feature and am unsure how it relates to #1539.

@casey
Copy link
Owner

casey commented Jan 15, 2025

I think this issue was about adding a preview window, which it now does.

which I don't understand why it does in the first place, as they execute fine if you just type out the argument

Don't they not work? If I have a recipe with a mandatory argument, after I hit return, won't it fail since the argument isn't provided?

@XBagon
Copy link

XBagon commented Jan 15, 2025

I think this issue was about adding a preview window, which it now does.

Add preview and command-line argument support for default chooser
I guess this is a two part issue, which I didn't even realize until now.
The video showcases the imagined argument support pretty well at the end. After selecting run, you can type in the arguments.

Don't they not work? If I have a recipe with a mandatory argument, after I hit return, won't it fail since the argument isn't provided?

I could have sworn it did work with an optional argument (as recipes with mandatory arguments aren't shown), but I cannot reproduce it now.

@casey
Copy link
Owner

casey commented Jan 15, 2025

It definitely does work with optional arguments. If it's filtering out recipes which can take zero arguments, that's definitely a bug.

@XBagon
Copy link

XBagon commented Jan 15, 2025

It is shown, but I cannot put the argument after and then successfully execute.
Which I thought I managed to do, but I take that back 😅.

Also note the run command in the example, which does have mandatory arguments and is still shown.
So I'd still like this to happen, maybe it needs a new issue?

@casey
Copy link
Owner

casey commented Jan 15, 2025

I'm not sure that just can help with this, isn't it up to the chooser whether it lets you type in an argument value or otherwise modify the command line before execution?

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