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

2014-09-26 Thread Jean-Michel Pichavant
- Original Message -
> From: vijna...@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.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-09-26 Thread Michael Torrie
On 09/26/2014 06:54 AM, vijna...@gmail.com wrote:
> 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

I don't doubt that.  I don't understand what you're asking either.  Can
you be more specific?  I've never heard of "PyCli."  What is it?
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-09-26 Thread Michael Torrie
On 09/26/2014 06:54 AM, vijna...@gmail.com wrote:
> 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

Wait, are you asking about making a command-line interface in Python?
If so, then there are a number of aspects you can google for:
- command line argument parsing.  See python docs on argparse
- A read/eval print loop using custom keywords and syntax, if you want
your program to be interactive.
   - you'll need to use readline to handle line editing
   - something to parse line input.  PyParsing perhaps.  Or some other
lexical parser, or manually do the parsing you need to do with .split()
or regular expressions.
   - possibly curses for doing screen output, though print() is probably
sufficient.

Except for pyparsing everything is in the standard library.
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-09-26 Thread vijnaana
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
-- 
https://mail.python.org/mailman/listinfo/python-list