Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78900
| From | Gelonida N <gelonida@gmail.com> |
|---|---|
| Subject | Re: CLI framework using python |
| Date | 2014-10-09 18:00 +0200 |
| References | <274771d2-4a11-40fe-bc31-ccfaa7d32690@googlegroups.com> <CACDG_KeytO8LV0yfGQ+nx+tRTTLd=64CwCwdsYnE=pdMsf0Z9w@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14720.1412870470.18130.python-list@python.org> (permalink) |
On 10/09/2014 05:25 PM, Unix SA wrote: > Hello, > > Go for Optparse.. Look at below docs on how to use it. > > http://pymotw.com/2/optparse/ > For newer projects I'd suggest argparse (part of Python since 2.7 and can be downloaded / installed for 2.5 / 2.6). https://docs.python.org/2.7/library/argparse.html argparse is very powerfull. you might be interested in looking at subparsers. For calling commands in a slightly nicer way than os.system / sybprocess.Popen you might look at sh or plumbum https://pypi.python.org/pypi/sh https://pypi.python.org/pypi/plumbum > Regards, > DJ > > On Thu, Oct 9, 2014 at 5:50 PM, <vijnaana@gmail.com > <mailto:vijnaana@gmail.com>> wrote: > > Hi, > > I need to develop a python CLI framework. > > For example if i need to set an ip address in linux: > > ifconfig eth0 172.16.25.125 > > I should be able to use python to do the above. > > 1. The user will execute a python script to which i will pass the > params eth0 and ip address (something like ifconf.py eth0 > 172.16.25.125) > > 2. Within the script i grab the params and do something to the > effect of user executing 'ifconfig eth0 172.16.25.125' from the shell. > > 3. There are other such commands for which i will be using python > scripts. I came across pyCLI, but it doesn't have much > documentation, so couldn't figure out how to move forward. > > 4. The CLI framework needs to reuse code so i didn't want to use > pure python and develop a framework from scratch. Rather use > something like pyCLI/CLIFF. > > The problem is lack of documentation with examples on how to use the > above. > > Any guidance would be greatly appreciated. > > Regards & Thanks, > Vij > > -- > https://mail.python.org/mailman/listinfo/python-list > > > >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
CLI framework using python vijnaana@gmail.com - 2014-10-09 05:20 -0700
Re: CLI framework using python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-10-09 09:07 -0400
Re: CLI framework using python Unix SA <d.joshi84@gmail.com> - 2014-10-09 20:55 +0530
Re: CLI framework using python Gelonida N <gelonida@gmail.com> - 2014-10-09 18:00 +0200
Re: CLI framework using python Rustom Mody <rustompmody@gmail.com> - 2014-10-10 01:43 -0700
Re: CLI framework using python Gelonida N <gelonida@gmail.com> - 2014-10-10 13:58 +0200
Re: CLI framework using python Python UL <python@rgbaz.eu> - 2014-10-09 18:08 +0200
Re: CLI framework using python vijnaana bhairava <vijnaana@gmail.com> - 2014-10-14 06:33 -0700
Re: CLI framework using python Chris Angelico <rosuav@gmail.com> - 2014-10-15 00:43 +1100
Re: CLI framework using python "Naoki INADA" <songofacandy@gmail.com> - 2014-10-14 07:15 -0700
Re: CLI framework using python vijnaana bhairava <vijnaana@gmail.com> - 2014-10-15 09:05 -0700
csiph-web