Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'argument': 0.05; 'output,': 0.09; 'parsing': 0.09; 'python': 0.11; 'cli': 0.16; 'command-line': 0.16; 'expressions.': 0.16; 'folks,': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'lexical': 0.16; 'subject:books': 0.16; 'subject:tutorials': 0.16; 'syntax,': 0.16; 'wrote:': 0.18; 'command': 0.22; 'python?': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'parse': 0.24; 'source': 0.25; 'possibly': 0.26; 'subject: : ': 0.26; 'asking': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'linux.': 0.31; 'subject:some': 0.31; 'probably': 0.32; 'interface': 0.32; 'regular': 0.32; 'screen': 0.34; 'except': 0.35; 'something': 0.35; 'google': 0.35; 'there': 0.35; 'library.': 0.36; 'doing': 0.36; "didn't": 0.36; 'material': 0.36; 'so,': 0.37; 'message- id:@gmail.com': 0.38; 'same.': 0.38; 'handle': 0.38; 'to:addr :python-list': 0.38; 'aspects': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'commands': 0.60; 'manually': 0.60; "you'll": 0.62; 'making': 0.63; 'email addr:gmail.com': 0.63; 'for:': 0.64; 'subject:Need': 0.64; 'more': 0.64; 'parser,': 0.84; 'subject:good': 0.84; 'wait,': 0.93 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Fri, 26 Sep 2014 08:58:43 -0600 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131118 Thunderbird/17.0.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: PyCli : Need some reference to good books or tutorials on pycli References: <48e1bd9f-a2c6-4c97-a971-0653e44a29c0@googlegroups.com> In-Reply-To: <48e1bd9f-a2c6-4c97-a971-0653e44a29c0@googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411743533 news.xs4all.nl 2855 [2001:888:2000:d::a6]:53691 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78380 On 09/26/2014 06:54 AM, vijnaana@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.