From afd410125d803da8dd69e3311732286d6a09c4e0 Mon Sep 17 00:00:00 2001 From: kracekumar Date: Wed, 9 May 2012 01:05:32 +0530 Subject: [PATCH] added an example get_each_args.py --- clint/textui/r.txt | 1 + examples/args.py | 3 ++- examples/get_each_args.py | 13 +++++++++++++ examples/get_each_args.sh | 4 ++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 clint/textui/r.txt create mode 100644 examples/get_each_args.py create mode 100755 examples/get_each_args.sh diff --git a/clint/textui/r.txt b/clint/textui/r.txt new file mode 100644 index 0000000..32f95c0 --- /dev/null +++ b/clint/textui/r.txt @@ -0,0 +1 @@ +hi \ No newline at end of file diff --git a/examples/args.py b/examples/args.py index 09301b3..777aeda 100644 --- a/examples/args.py +++ b/examples/args.py @@ -16,4 +16,5 @@ with indent(4, quote='>>>'): puts(colored.red('NOT Files detected: ') + str(args.not_files)) puts(colored.red('Grouped Arguments: ') + str(dict(args.grouped))) -print \ No newline at end of file +print + diff --git a/examples/get_each_args.py b/examples/get_each_args.py new file mode 100644 index 0000000..b18c7ad --- /dev/null +++ b/examples/get_each_args.py @@ -0,0 +1,13 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- + +from clint import args +from clint.textui import puts, colored + +all_args = args.grouped + +for item in all_args: + if item is not '_': + puts(colored.red("key:%s"%item)) + print(all_args[item].all) + diff --git a/examples/get_each_args.sh b/examples/get_each_args.sh new file mode 100755 index 0000000..0e940be --- /dev/null +++ b/examples/get_each_args.sh @@ -0,0 +1,4 @@ +echo "python get_each_args.py --name kracekumar --email me@kracekumar.com" +python get_each_args.py --name kracekumar --email me@kracekumar.com +echo "python get_each_args.py --languages python c html ruby --email me@kracekumar.com" +python get_each_args.py --langauges python c html ruby --email me@kracekumar.com