-
Notifications
You must be signed in to change notification settings - Fork 386
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
tar file completion not working as expected under various option combinations #1194
Comments
This seems to be intentional according to the code comments in our bash-completion/completions/tar Lines 6 to 16 in 8304d33
Bash-completion had been advising users not to specify the arguments in that way. |
Yes, as I mentioned in the report, I have seen bash-completion's 'advice', but it certainly would be very nice if tar's "traditional" argument style was supported. The comment you quoted does claim "if user starts the 'first' tar argument without leading dash, we treat the command line appropriately." Is that not implying that the "traditional" argument style is supported? The repro cases I provided do give the traditional options as the first argument to tar, and it doesn't seem like the command line is being handled as advertised. BTW, I didn't see this comment buried in the source until recently, so I guess most people who bump into this never see the advice, and just believe that bash-completion is broken when it comes to tar. In any case, there is a bug where with the "unix-style" argument format currently requiring the 'f' to be last, right? Out of curiosity, why is bash completion opinionated about tar's supported argument styles in the first place? Is there a technical reason why it's difficult, is this something bash-completion's design can't do very well? If there isn't a strong technical reason, humor me for a moment, here are some reasons it would be nice to drop the 'advice' and support tar's traditional argument style. The "traditional" style is the smallest / fastest-to-type, and the longest supported argument style for tar; tar is not deprecating the "traditional" argument style, it's a valid, supported, and ongoing alternative according to tar's documentation; the "traditional" style is the first one described in the man page; and the advice is asking users to change ingrained habits. |
Describe the bug
Filename completion isn't working with tar in some cases where I expect it to work.
When extracting from an archive with tar's "traditional" option style (block of option letters with a dash), filename completion only works when 'f' is the last option letter in the options block, even though tar does not require the f argument to be last (see the tar man page for an example). I usually type something like "tar -xfvz file..." from muscle memory. This has been bugging me for years and I only just realized what's going on by trying all 24 letter permutations and mapping which ones work. :P Would it be relatively easy to allow "tar -xfvz ar" to complete filenames? In this case, completion is empty, so a fallback question might be can filenames be completed by default when there is no other completion?
I see the comment in completions/tar about advising to use a dash before the option block, but it would be extra nice if tar completion worked with the no-dash option block too. After all, tar supports the no-dash style and does not advise against it's use. Are there technical limitations?
When creating an archive, it seems filename completion of the archive with an existing name doesn't work even when the 'f' option is last or is given in GNU long-style. One reason to support this is when intentionally overwriting an archive. (It's not uncommon for me to have to create an archive several times before I get it right.) Another reason is when working on multiple tar files with a common prefix. A third, perhaps, is just to see that completion is working. Is the reason to disallow filename completion of the archive for safety? Are there other reasons not to complete existing filenames when creating an archive?
To reproduce
Versions (please complete the following information)
Debug trace
tar-completion.log
The text was updated successfully, but these errors were encountered: