Make command line GNU-compatible
See original GitHub issueWhile trying to implement zsh completion for Paket I found that the way Paket handles command line arguments is a bit off to what zsh regards as “the right way” which in turn makes implementing completion overly complex. I also found that some strings Paket accepts as arguments are (for reasons beyond my understanding) not written as such.
Take for example this line:
paket add nuget NUnit group Test project Foo.csproj --verbose --force
What’s the command and what are parameters?
add nuget
is the commandgroup
is an argumentTest
is a parameter to thegroup
argument
project
is an argumentFoo.csproj
is a parameter to thegroup
argument
--verbose
is an argument that takes no parameters--force
is an argument that takes no parameters
So how should command line completion distinct between command and arguments (with or without parameters)? The short answer is that it can’t. At least, I was not able to make it work with zsh without going great lengths and essentially reimplement the standard GNU-style arguments completion that ships with zsh (a 16KB function).
My suggestion is to align the command line to GNU-style:
paket add nuget NUnit --group Test --project Foo.csproj --verbose --force
paket add nuget NUnit --group=Test --project=Foo.csproj --verbose --force
Both should be regarded as the same. If the second line won’t be parsed by Argu, that’s fine with me as well.
I know this results in a breaking change, I suggest this to be planned for v4.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:11 (9 by maintainers)
Top GitHub Comments
I spent some time to work on my zsh completion and GNU-style args for
paket add
. Feedback is appreciated!https://asciinema.org/a/76d0gjmogm7f0vxntx05f2u94
Fixed