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>
|
The function modified in this PR is |
I can rework this in a different direction if preferred. |
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