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

Completion confused when using --justfile #936

Open
neur0manc opened this issue Aug 3, 2021 · 4 comments
Open

Completion confused when using --justfile #936

neur0manc opened this issue Aug 3, 2021 · 4 comments

Comments

@neur0manc
Copy link

Hi, great project, thank you so much!

Intro

I laughed at the comment "I’m pretty sure that nobody actually uses this feature" here, because I've been using exactly that for my global Makefile for a while now. I had a shell alias mmake that executes some tasks to manage my macOS workstation. For example upgrading all homebrew packages (mmake upgrade) or save a list of installed homebrew packages (mmake freeze). So I'm glad that this is implemented. 👍

The Actual Issue

The shell completion that is generated with zsh does not take that switch into account it seems. When defining the alias .just as just -f=~/.justfile, .just -l will display the recipes of the justfile in the current directory instead of the recipes defined in ~/.justfile.

Have a great day 🌻

@casey
Copy link
Owner

casey commented Aug 4, 2021

I laughed at the comment "I’m pretty sure that nobody actually uses this feature" here, because I've been using exactly that for my global Makefile for a while now. I

Awesome, that's great!

One note, as of version 0.10.0 which was just released, just will look for files named .justfile in addition to justfile, so just may find your global justfile when you don't want it to. If you don't mind this, no change is necessary, but if you want to avoid it, you could name it something like ~/.global.justfile.

The shell completion that is generated with zsh does not take that switch into account it seems. When defining the alias .just as just -f=~/.justfile, .just -l will display the recipes of the justfile in the current directory instead of the recipes defined in ~/.justfile.

Gotcha, that's tricky. The zsh completions are auto-generated by clap, the argument parsing library just uses, with improvements by various contributors. I'll leave this issue open, in case someone wants to dive in, but I don't actually have much experience modifying the completions themselves, or with how zsh completions work in general, so it might be a while before this gets tackled.

@neur0manc
Copy link
Author

One note, as of version 0.10.0 which was just released

Oh, thanks for the suggestion. I just did that.

I'll leave this issue open, in case someone wants to dive in, but I don't actually have much experience modifying the completions themselves, or with how zsh completions work in general, so it might be a while before this gets tackled.

Of course, no pressure 🙂

@casey
Copy link
Owner

casey commented Aug 4, 2021

One note for anyone who wants to take this on, I think this could be made easier by adding a subcommand, something like --print-justfile-location. The autocomplete script could add --print-justfile-location to any just invocation, in this case one from an alias like just -f ~/justfile, so you could get the justfile location programmatically.

@casey
Copy link
Owner

casey commented Dec 10, 2021

Please thumbs-up the original issue instead of commenting, since commenting generates a notification. Thank you!

@casey casey removed the completions label Jan 25, 2023
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

No branches or pull requests

2 participants