Skip to content

Commit

Permalink
Merge pull request #1960 from dbaynard/fix/zsh-completion
Browse files Browse the repository at this point in the history
Fix zsh completion
  • Loading branch information
anjakefala committed Jul 15, 2023
2 parents 3480874 + 0a65013 commit 77c97a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@ jobs:
sudo apt install aha
dev/mkman.sh
- name: Ensure VisiData can create completions
run: python -v dev/zsh-completion.py
5 changes: 3 additions & 2 deletions dev/zsh-completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

sys.path.insert(0, dirn(dirn((os.path.abspath(__file__)))))
from visidata import vd
from visidata.main import option_aliases

ZSH_COMPLETION_FILE = "_visidata"
ZSH_COMPLETION_TEMPLATE = "dev/zsh-completion.in"
Expand All @@ -18,7 +17,9 @@

def generate_completion(opt):
prefix = "--" + opt.name
shortnames = [key for key, value in option_aliases.items() if value[0] == opt.name]
shortnames = [
key for key, value in vd.option_aliases.items() if value[0] == opt.name
]
if len(shortnames):
if len(shortnames[0]) == 1:
shortname = "-" + shortnames[0]
Expand Down

0 comments on commit 77c97a2

Please sign in to comment.