-
Notifications
You must be signed in to change notification settings - Fork 479
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
Allow listing recipes in submodules with --list-submodules
#2113
Conversation
If I may add my preference? I'm in favor of the nested view as I'm not that comfortable showing The way we've used the "module-like" just scripts so far has relied on the separator being a space character and I'd like to avoid seeing the I can see us using The The old way of using "module-like" just scripts has also relied only on whitespace separated modules so we don't have any usage of e.g. I do agree that it's slightly easier to read the output when the list contains of One more question: Should this have some sort of depth limit option as well? What if there are submodules on 4 levels — should all of them be shown or would it be possible to limit the depth somewhere? I don't know if that would be useful to have but I bet it would be asked at some point in the future 😅 |
The issue with spaces in a flattened view is that it wouldn't be possible to tell what was a submodule/recipe and what was an argument:
The output of When, eventually, you can reference variables and recipes in other modules, you'll have to specify module paths using mod foo
bar: foo::baz So the command-line interfaces will all accept I'll probably add some sort of option to list submodules nested, as in this PR, and flattened, in another PR, using As far as a depth limit, I'd be happy to add that in the future, feel free to make an issue if/when you want it! |
Yeah to clarify my opinion — I don't have any objections of using I'm mostly against showing that in the output of any I also do agree that the flattened view as in your example would be confusing and would not want that either. It is indeed a tricky case!
I'm not sure I fully follow this train of thought, so let me try to understand what you mean with this example:
I would image
And then I'd do
But it sounded like what I'd have instead is this when running
Do correct me if I'm wrong! I'm mostly worried that the tab autocompletions would get useless for us if all the submodule recipes would also be shown in there with the |
@casey The original nested output is my personal preference. I wouldn't use the flattened view. I don't use the concept of a default recipe, i.e. I don't have
Because I prefer to see what's available and pick from the list rather than have a default. So, I can easily add a new flag @valscion I believe that the output of The current shell completions are generated by applying simple replacements to the clap-generated default completions: I wouldn't personally like to try to implement more intelligent submodule recipe completion handling like this. This is the point where hand-crafted completion scripts would be better. |
Yeah I do agree — but this "technically correct" vs. what I'm in favor of as "intuitive behavior" are different. For us, it would make the autocompletion cumbersome and the first For example, the Then I can tab to just the This is how I'd expect "top level modules" to first work and then submodules showing only after I've explicitly tabbed to show the submodules. |
Okay, nice. I'm going to merge this, if someone wants the flat view, they can open an issue. The completion scripts are extremely hacky. I would prefer to use space-separated recipe paths, and I would prefer to complete them one at a time, but this just isn't possible with the current approach, since the completion scripts have no idea which arguments are present on the command line so far, so they can't incrementally complete recipes and modules as the user descends into modules. Fixing this is blocked on clap-rs/clap#1232, which is a proposed improvement to claps's completion engine. I suppose someone could try modifying the completion scripts, but that gets messy fast. |
Oh wow what a rabbit hole — I understand now that this isn't such an easy feat 😅 |
@crdx Do you prefer a nested view, like this:
Or a flattened view, like this: