5
zsh bash完成支持complete -C 'custom command for completion' command
?在zsh中使用bash完成-C -C
我以前寫的腳本是bash完成的功能,這是我與
complete -C 'tu --get-bash-completion' tu
使我想我的同事誰使用zsh來能夠使用完畢,所以我嘗試測試有了這樣的.zshrc文件的bash補全兼容:
autoload compinit
compinit
autoload bashcompinit
bashcompinit
complete -C 'tu --get-bash-completion' tu
當我嘗試使用此完成,它看起來像zsh中呼籲完成腳本,而不將參數調用的bash它與(firstword,current_word,previous_word)。
tom-mba:~ tomb$ zsh
tom-mba% tu Traceback (most recent call last):
File "/usr/local/bin/tu", line 7, in <module>
execfile(__file__)
File "/Users/tomb/Dropbox/code/TrelloCardUpdate/bin/tu", line 3, in <module>
cli.CLI()
File "/Users/tomb/Dropbox/code/TrelloCardUpdate/trellocardupdate/cli.py", line 156, in CLI
getcompletion(sys.argv[i+1:i+4])
File "/Users/tomb/Dropbox/code/TrelloCardUpdate/trellocardupdate/cli.py", line 86, in getcompletion
assert len(args) == 3, [args, sys.argv]
AssertionError: [[], ['/usr/local/bin/tu', '--get-bash-completion']]
我使用在Mac自制安裝的zsh:
tom-mba:~ tomb$ zsh --version
zsh 5.0.2 (x86_64-apple-darwin11.4.2)
tom-mba:~ tomb$ which zsh
/usr/local/bin/zsh
即將到來的答案,關閉zsh郵件列表! – Thomas