简体   繁体   中英

Python readline Auto-Complete

I want to implement auto-complete in Command Line Interface for the following :

Food : 
  Fruits:
    Apples
    Oranges
  Vegetables:
    Carrot
    Beetroot
  Snacks:
    Chocolate

The output for the <TAB> would be : food
and so on...

Commands would be like : Food Fruits Apples or Food Snacks Chocolate

Came across this https://pymotw.com/2/readline/ while googling. But I don't understand how begin/end works. And how it will change for further nesting.

Any sort of help is appreciated. (Writing code in python. Prefer to use readline library)

如果您使用像click这样的库来制作 CLI,您将主要免费获得 http://click.pocoo.org/5/bashcomplete/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM