Skip to content

fix(export): do not output equals sign for -f arg completions #779

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

Merged
merged 1 commit into from
Aug 19, 2022
Merged
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
2 changes: 1 addition & 1 deletion completions/export
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ _export()
return
fi
local suffix=""
if ! $remove; then
if ! $remove && [[ $action != function ]]; then
suffix="="
compopt -o nospace
fi
Expand Down
12 changes: 12 additions & 0 deletions test/t/test_export.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import pytest

from conftest import assert_bash_exec


class TestExport:
@pytest.mark.complete("export BASH")
Expand Down Expand Up @@ -34,3 +36,13 @@ def test_7(self, completion):
@pytest.mark.complete("export -", require_cmd=True)
def test_8(self, completion):
assert completion

@pytest.fixture(scope="class")
def export_f_canary(self, request, bash):
assert_bash_exec(bash, "_comp__test_export_f_canary() { return; }")

@pytest.mark.complete("export -f _comp__test_export_f_canar")
def test_no_equals_sign_for_function(self, completion, export_f_canary):
assert completion
assert "=" not in "".join(completion)
assert completion.endswith(" ")