diff --git a/examples/args.py b/examples/args.py new file mode 100644 index 0000000..39a0366 --- /dev/null +++ b/examples/args.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +import sys +import os + +sys.path.insert(0, os.path.abspath('..')) + +from clint import args +from clint.textui import puts, colored, indent + +with indent(4, quote='>>>'): + puts(colored.red('Aruments passed in: ') + str(args.all)) + puts(colored.red('Flags detected: ') + str(args.all_without('py'))) + puts(colored.red('Files detected: ') + str(args.files)) + puts(colored.red('Grouped Arguments: ') + str(dict(args.grouped))) + +print \ No newline at end of file diff --git a/examples/args.sh b/examples/args.sh new file mode 100755 index 0000000..ae5a000 --- /dev/null +++ b/examples/args.sh @@ -0,0 +1,12 @@ + +echo 'No arguments:' +python args.py + +echo 'A few arguments:' +python args.py -s this that --import this and that and this and that + +echo 'A few expanded file arguments:' +python args.py *.py + +echo 'A few non-expanded file arguments:' +python args.py '*.py'