Skip to content

Commit 171be68

Browse files
committed
fix tests
1 parent e96c96f commit 171be68

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

shtab/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,11 +606,14 @@ def command_case(prefix, options):
606606

607607
return f"""\
608608
{prefix}() {{
609-
local context state line curcontext="$curcontext" one_or_more='(*)' remainder='(-)*' default='*::: :->{name}'
609+
local context state line \
610+
curcontext="$curcontext" one_or_more='(*)' remainder='(-)*' default='*::: :->{name}'
610611
611612
# Add default positional/remainder specs only if none exist, and only once per session
612613
if (( ! {prefix}_defaults_added )); then
613-
if (( ${{{prefix}_options[(I)${{(q)one_or_more}}*]}} + ${{{prefix}_options[(I)${{(q)remainder}}*]}} + ${{{prefix}_options[(I)${{(q)default}}]}} == 0 )); then
614+
if (( ${{{prefix}_options[(I)${{(q)one_or_more}}*]}} +\
615+
${{{prefix}_options[(I)${{(q)remainder}}*]}} +\
616+
${{{prefix}_options[(I)${{(q)default}}]}} == 0 )); then
614617
{prefix}_options+=(': :{prefix}_commands' '*::: :->{name}')
615618
fi
616619
{prefix}_defaults_added=1

tests/test_shtab.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ def test_prog_scripts(shell, caplog, capsys):
133133
elif shell == "zsh":
134134
assert script_py == [
135135
"#compdef script.py", "_describe 'script.py commands' _commands",
136+
'local context state line curcontext="$curcontext" '
137+
"one_or_more='(*)' remainder='(-)*' default='*::: :->script.py'",
136138
"_shtab_shtab_options+=(': :_shtab_shtab_commands' '*::: :->script.py')", "script.py)",
137139
"compdef _shtab_shtab -N script.py"]
138140
elif shell == "tcsh":

0 commit comments

Comments
 (0)