Skip to content

Commit f9e48b7

Browse files
Zhe YuDavidyz
authored andcommitted
fix(cli): Fix shtab generation for zsh and add tests for it. Fix #211
1 parent bb3d169 commit f9e48b7

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

src/vectorcode/cli_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def get_cli_parser():
358358
)
359359
prompts_parser.add_argument(
360360
"prompt_categories",
361-
choices=PromptCategory,
361+
choices=[str(i) for i in PromptCategory],
362362
type=PromptCategory,
363363
nargs="*",
364364
help="The subcommand(s) to get the prompts for. When not provided, VectorCode will print the prompts for `query`.",

tests/test_cli_utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import os
2+
import subprocess
3+
import sys
24
import tempfile
35
from typing import Any, Dict
46
from unittest.mock import patch
@@ -539,3 +541,15 @@ def test_cleanup_path():
539541
"~", "test_path"
540542
)
541543
assert cleanup_path("/etc/dir") == "/etc/dir"
544+
545+
546+
def test_shtab():
547+
for shell in ("bash", "zsh", "tcsh"):
548+
assert (
549+
subprocess.Popen(
550+
[sys.executable, "-m", "vectorcode.main", "-s", shell],
551+
stderr=subprocess.PIPE,
552+
)
553+
.stderr.read()
554+
.decode()
555+
) == ""

0 commit comments

Comments
 (0)