当我发出git with tab时,它可以自动完成一个列表,我想写一个test.py,当我输入test.py和tab时,它可以自动完成在test.py中定义的给定列表,这可能吗?
$ git [tab]
add branch column fetch help mv reflog revert stash
am bundle commit filter-branch imap-send name-rev relink rm status
annotate checkout config format-patch init notes remote send-email submodule
apply cherry credential fsck instaweb p4 repack shortlog subtree
archive cherry-pick describe gc log pull replace show tag
bisect clean diff get-tar-commit-id merge push request-pull show-branch whatchanged
blame clone difftool grep mergetool rebase reset stage 发布于 2017-07-20 23:33:01
您要查找的方法是:readline.set_completer。此方法与bash shell的readline交互。它很容易实现。示例:https://pymotw.com/2/readline/
https://stackoverflow.com/questions/45218862
复制相似问题