Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'parser': 0.07; '%s"': 0.09; 'framework.': 0.09; 'params': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:using': 0.09; 'python': 0.11; '(something': 0.16; 'cli': 0.16; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'scripts.': 0.16; 'subject:python': 0.16; 'thu,': 0.19; 'command': 0.22; 'example': 0.22; 'shell': 0.22; 'creating': 0.23; 'url:home': 0.24; 'script': 0.25; 'pass': 0.26; 'header:X -Complaints-To:1': 0.27; "doesn't": 0.30; 'figure': 0.32; 'something': 0.35; 'but': 0.35; 'there': 0.35; 'executing': 0.36; 'charset:us-ascii': 0.36; 'should': 0.36; 'turn': 0.37; 'implement': 0.38; 'to:addr:python-list': 0.38; "couldn't": 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'commands': 0.60; 'most': 0.60; 'address': 0.63; 'email addr:gmail.com': 0.63; 'such': 0.63; 'grab': 0.64; 'within': 0.65; 'forward.': 0.84; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: CLI framework using python Date: Thu, 09 Oct 2014 09:07:56 -0400 Organization: IISS Elusive Unicorn References: <274771d2-4a11-40fe-bc31-ccfaa7d32690@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-73-116-204.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1412860100 news.xs4all.nl 2882 [2001:888:2000:d::a6]:48232 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78890 On Thu, 9 Oct 2014 05:20:34 -0700 (PDT), vijnaana@gmail.com declaimed the following: >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. > Which will most likely turn into something like (quick&dirty version) os.system("ifconfig %s %s" % (userDevice, userIP)) >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. > Unless you intend to implement those commands internally, all you are creating is a command line parser that spawns out to a hidden shell to actually execute the native command executable... -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/