-
Notifications
You must be signed in to change notification settings - Fork 249
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
Auto completion #490
Auto completion #490
Conversation
add escape colon method for autocomplete parameters.
except the "version" and "mb", for which autocompletion of remote buckets/keys does not make sense.
Co-Authored-By: Selman Kayrancioglu <[email protected]>
UpdatesBackgroundThe last version that supported the autocompletion was v7.0.0. It used posener/complete and correctly handled s3 key completions. However it didn't completed local files/directories. I've implemented1 autocompletion with both urfave/cli and posener/complete/v2. In zsh it worked accurately -except the need to programmatically2 escape colons. In bash however the colon's need to be handled more specially. Because, in bash colons are considered to be word breaks. So we should handle the colons specially. Since v7.0.0 worked correctly, at the time, I've examined its implementation. It turned out that the completion script removes As an alternative solution we could use the bash-completion package to handle colons without changing COMP_WORDBREAKS. But this time the user need to have her bash As a third option we can also modify s5cmd's autocompletion suggestions to match the expectations of bash. It can check the SHELL environment variable to determine the SHELL and left trim the autocompletion for bash. Current Status of Alternativeswith urfave/cli using bash-completion
with urfave/cli without bash-completion package
with posener/complete/v2.
ps: First two of them have a little (?) problem:
but expected behaviour would be listing local files ( beware that TAB is pressed after a space) Footnotes |
- It used to complete full s3 keys at once, but now it only completes till next s3 seperator (slash) - bucket completion now appends slash (/) to the end of the bucket - autocomplete used to fall back to default bash behaviour after the autocompletion suggestions are filtered. So the default bash completion completed "s5cmd ls s3://b" to "s3://bin/" since there is a directory named "/bin/" in the local. Default behavior ignores "s3:" since : is a COMP_WORDBREAK. by moving the completion fallback to compgen function we ensure that local completions are also filtered properly.
I'm closing this PR in favour of #500. Among the autocompletion solutions: Posener/completeit supports zsh, bash and fish
it has 3 disadvantages
using urfave/cliit supports zsh, bash and pwsh Changing COMP_WORDBREAKSstraightforward and easy but unacceptable. using well-known
|
Adds extensive auto-completion support to s5cmd. Including:
Fixes #207
Fixes #372