Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions completions-core/tar.bash
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,7 @@ _comp_cmd_tar__posix()

_comp_cmd_tar__adjust_PREV_from_old_option

_comp_cmd_tar__cleanup_prev
_comp_cmd_tar__posix_prev_handle && return

_comp_cmd_tar__try_mode && return
Expand Down
26 changes: 26 additions & 0 deletions test/t/test_tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,30 @@ def test_24(self, completion):
def test_25(self, completion):
assert completion == "archive.tar.xz dir/ dir2/".split()

# Test combined short options with bsdtar (POSIX style), e.g. "bsdtar -tf"
@pytest.mark.complete("bsdtar -tf ", cwd="bsdtar")
def test_26(self, completion):
assert completion == "test.pax test.rar".split()

@pytest.mark.complete("bsdtar -f ", cwd="bsdtar")
def test_27(self, completion):
assert completion == "test.pax test.shar".split()

# Test combined short options with star (same POSIX completion function)
@pytest.mark.complete("star -tf ", cwd="tar")
def test_28(self, completion):
assert completion == "archive.tar.xz dir/ dir2/ escape.tar".split()

# The file argument of a combined short option in create mode only
# completes directories, like plain -cf
@pytest.mark.complete("bsdtar -cf ", cwd="tar")
def test_29(self, completion):
assert completion == "dir/ dir2/".split()

# The compression letter restricts the archive extensions; there is no
# .gz fixture, so only directories may show up
@pytest.mark.complete("bsdtar -tzf ", cwd="tar")
def test_30(self, completion):
assert completion == "dir/ dir2/".split()

# TODO: "tar tf escape.tar a/b"