Conversation
_comp_cmd_tar__posix did not normalize a bundled short option such as "-tf" down to its last letter before matching the previous word against "-f" and "-b", so unlike the GNU path (which calls _comp_cmd_tar__cleanup_prev) the file argument of combined short options was never completed for bsdtar and star. Call _comp_cmd_tar__cleanup_prev after _comp_cmd_tar__adjust_PREV_from_old_option so "-tf", "-bf", "-tvf" etc. complete archives/dirs like plain "-f" does. Signed-off-by: 付典 <fudianchn@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI disclosure: this change was prepared with AI coding agents, reviewed and revised line by line by me.
What
bsdtar -tf <TAB>andstar -tf <TAB>now complete archive files. Combined short options ending inforbcomplete their argument like the plain form. Plain-fis unchanged.Why
bsdtar and star parse combined short options like GNU tar does. The completion dropped the file argument for every combined form.
How
_comp_cmd_tar__posixcalls_comp_cmd_tar__cleanup_prevbefore matching the previous word, mirroring the GNU path.Root cause
_comp_cmd_tar__posix_prev_handlematches exact-fonly._comp_cmd_tar__cleanup_prev, which turns-tfinto-f, ran in the GNU path only.Testing
test_tar.py#test_26(bsdtar -tf): fails on main, passes with the fix.test_27(bsdtar -f) guards plain-f: passes on both.test_28-test_30:star -tfpositive,-cfcreate-mode combo guard (directories only),-tzfcompression-extension guard.bsdtar -t <TAB>and-tv <TAB>still complete nothing. Pre-existing gap in_comp_cmd_tar__try_list_archive, left untouched.Verification of the original issue
Issue reports no completion for
bsdtar -tf. With the fix, the same line completes archives likegtar -tfdoes.Fixes #1728