简体   繁体   中英

Python cmd module command aliases

I am making a command line interface in Python 3.1.1 using the cmd module.

Is there a way to create a command with more than one name eg "quit" and "exit"? Or would it just be a case of making a number of commands that all reference the same function?

Yes, it would just be a case of making a number of commands that all reference the same function.

This is common. It often helps to provide multiple common aliases for a command. It makes the user's life simpler because the odds of them guessing correctly are improved.

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