Closed hustcer closed 5 months ago
You are most welcome!
Shell completions are currently mostly generated by clap
, the argument parsing library. So support for nushell would have to be added to clap
, or someone would have to contribute hand-written completion scripts.
https://github.com/clap-rs/clap/issues/2778#issuecomment-992733874 Will this help? Thanks
Yup, if clap automatically generated nushell completions, that would definitely help.
Yup, if clap automatically generated nushell completions, that would definitely help.
I mean the last comment they replied: "If nushell works like bash where you have to write your own parser, #3166 could be a big help towards this." It doesn't look like they are going to provide “automatically generated nushell completions” support in clap
I think that might make it easier on the clap side to implement nushell completion support, but we would still have to wait for it to be implemented there before Just could take advantage of it.
It looks like Clap has adopted this: https://github.com/clap-rs/clap/tree/master/clap_complete_nushell
Then I imagine this depends on clap v4: https://github.com/casey/just/issues/1084
In the meanwhile you can put the following somewhere in your nushell config
def "nu-complete just" [] {
(^just --dump --unstable --dump-format json | from json).recipes | transpose recipe data | flatten | where {|row| $row.private == false } | select recipe doc parameters | rename value description
}
# Just: A Command Runner
export extern "just" [
...recipe: string@"nu-complete just", # Recipe(s) to run, may be with argument(s)
]
This was stolen from nushell-scripts (now in the link there is a more elaborated version, but I didn't test that yet)
Clap v4 support was finally merged, so this will make it into the next release!
Hi, Thanks for the great work, and
just
currently has no completion support for the modern, powerful and elegant NuShell, is there any plan for this? Thx