PyCli : Need some reference to good books or tutorials on pycli

Jean-Michel Pichavant jeanmichel at sequans.com
Fri Sep 26 11:45:17 EDT 2014


----- Original Message -----
> From: vijnaana at gmail.com
> To: python-list at python.org
> Sent: Friday, 26 September, 2014 2:54:48 PM
> Subject: PyCli : Need some reference to good books or tutorials on pycli
> 
> Hi Folks,
> 
> I need to develop a CLI (PyCli or similar)on Linux.
> To be more specific to develop Quagga(open source routing software)
> like
> commands using python instead of C.
> 
> Need some good reference material for the same.
> 
> P.S google didn't help
> 
> Thank You!
> Vij


Have you considered using ipython ?

I have built a CLI on top of that and it's pretty easy and effective, and it requires almost no dev. The following code is untested but it should give you an idea of what I mean.

cli.py:

import IPython
import yourApi

# explict exposure
foo = yourApi.foo
bar = yourApi.bar

# or you can expose all the content of yourApi
api = yourApi

# delete unwanted names
del yourApi
del IPython

# start the interactive CLI
IPython.frontend.terminal.embed.InteractiveShellEmbed(banner1='Hello Word', exit_msg='bbye')()

Regards,

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.


More information about the Python-list mailing list