Cli framework supports TAB key auto-complete

i’m looking for any cli framework supports tab key auto-completion feature. I looked at spf13/cobra and docker/docker-machine cli sample but they didn’t have the option for this feature.

for example, if I have 4 commands for App(show/set/start/status), when I type

“App s”

and then press TAB key, the cli can come back with 4 options


and if I continue type

“App stat”

and then press TAB key, the cli can auto fill in “status” word. Another nice feature is that I can use “App stat” directly with the next sub-command without fully typing/finishing “Status” word.

this kind of behavior is popular for network device cli like Cisco IOS/NX-OS.

any pointers?


If you mean tab completion from a shell like bash, cobra can generate the completion files:

If you mean tab completion inside your program (e.g., a custom application shell) then try or its underlying library

1 Like

thanks for the info!

Try alecthomas/kingpin

will do. it does look very simple.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.