Line completion with custom commands

后端 未结 6 1017
抹茶落季
抹茶落季 2020-12-23 17:33

my Python program can be launched with a range of different options (or subcommands) like:

$ myProgram doSomething
$ myProgram doSomethingElse
$ myProgram no         


        
6条回答
  •  抹茶落季
    2020-12-23 17:49

    If I understand correctly you want line completion on the command line before your python script starts. Then you shouldn't search for a python solution, but look at the shell features.

    If you are using bash you can look at /etc/bash_completion, and at least on debian/ubuntu you should create a file in /etc/bash_completion.d/ that specifies the completions for your program.

提交回复
热议问题