CLI framework using python
gelonida at gmail.com
Thu Oct 9 18:00:57 CEST 2014
On 10/09/2014 05:25 PM, Unix SA wrote:
> Go for Optparse.. Look at below docs on how to use it.
For newer projects I'd suggest argparse (part of Python since 2.7 and
can be downloaded / installed for 2.5 / 2.6).
argparse is very powerfull. you might be interested in looking at
For calling commands in a slightly nicer way than os.system /
sybprocess.Popen you might look at sh or plumbum
> On Thu, Oct 9, 2014 at 5:50 PM, <vijnaana at gmail.com
> <mailto:vijnaana at gmail.com>> wrote:
> 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
> 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
> Any guidance would be greatly appreciated.
> Regards & Thanks,
More information about the Python-list