Demo entry 6645372

rsSearch

   

Submitted by anonymous on Oct 10, 2017 at 08:55
Language: Python. Code size: 679 Bytes.

#!/usr/bin/env python
# -*- coding=utf-8 -*-
"""my test module

Usage:
    hello <name> [--age=<age>]

Options:
    -h, --help      Show help.
    --version       Show Version.
    --age=<age>     The age[default: 18].

"""

import docopt
import colorama


def main():

    colorama.init()

    arguments = docopt.docopt(__doc__, help=True, version='hello 1.0', options_first=False)
    # print arguments

    name = arguments.get('<name>')
    age = arguments.get('--age')

    print 'Hello, {start}{name}{end}, you are {start}{age}{end} years old.'\
        .format(name=name, age=age, start=colorama.Fore.CYAN, end=colorama.Fore.RESET)


if __name__ == '__main__':
    main()

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).