Metadata-Version: 1.0
Name: cmdstyle
Version: 0.1.0
Summary: Command line interface framework
Home-page: http://pypy.python.org/pypi/cmdstyle/
Author: Henri Wiechers
Author-email: hwiechers@gmail.com
License: LICENSE.txt
Description: ========
        cmdstyle
        ========
        
        cmdstyle is a library for creating command line interfaces using the command 
        style used by programs like `svn` or `hg`.
        
        Example
        =======
        
        Sample File::
        
            #! /usr/bin/env python3.2
            
            import sys
            
            import cmdstyle
            
            class HelloCommand(cmdstyle.Command):
                'Print a greeting'
            
                name = cmdstyle.PosParam()
                shout = cmdstyle.Flag(
                    description='Print the greeting in upper case',
                    shortname='') 
                exclamations = cmdstyle.Option(
                    description='The number of exclamation marks used to end the '
                                'greeting',
                    default=1)
            
                def __call__(self):
                    #Note that the library does not do validations
                    exclamations_int = int(self.exclamations)
            
                    greeting = 'Hello'
                    if self.name:
                        greeting += ', ' + self.name
                    if self.shout:
                        greeting = greeting.upper()
                    greeting += exclamations_int * '!'
            
                    print(greeting)
                    
            
            class ByeCommand(cmdstyle.Command):
                'Print bye'
            
                def __call__(self):
                    print('Bye!')
            
            
            program = cmdstyle.Program(
                'sample.py', 
                'Sample Program', 
                'Just a sample program', 
                'http://...')
            
            program.register(HelloCommand())
            program.register(ByeCommand())
            
            if __name__ == '__main__':
                program.run(sys.argv)
        
        Sample Being Used::
        
            $ ./sample.py
            Use `sample.py help` for usage.
        
        
            $ ./sample.py help
            usage: sample.py <command> [options] [args]
            
            Sample Program
            Just a sample program
            
            Available commands:
              bye
              hello
            
            Use `sample.py help <command>` for help on a specific command.
            See http://... for additional information.
        
        
            $ ./sample.py help hello
            hello: Print a greeting
            usage: hello NAME
            Options:
            
               --shout             Print the greeting in upper case
            -e --exclamations ARG  The number of exclamation marks used to end the greeting
        
        
            $ ./sample.py hello
            Hello!
        
        
            $ ./sample.py hello --shout --exclamations 3
            HELLO!!!
        
        
        
Keywords: cli
Platform: UNKNOWN
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Other Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: User Interfaces
