Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #78382 > unrolled thread

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

Started byJean-Michel Pichavant <jeanmichel@sequans.com>
First post2014-09-26 17:45 +0200
Last post2014-09-26 17:45 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Re: PyCli : Need some reference to good books or tutorials on pycli Jean-Michel Pichavant <jeanmichel@sequans.com> - 2014-09-26 17:45 +0200

#78382 — Re: PyCli : Need some reference to good books or tutorials on pycli

FromJean-Michel Pichavant <jeanmichel@sequans.com>
Date2014-09-26 17:45 +0200
SubjectRe: PyCli : Need some reference to good books or tutorials on pycli
Message-ID<mailman.14397.1411746319.18130.python-list@python.org>
----- Original Message -----
> From: vijnaana@gmail.com
> To: python-list@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.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web