mirror of
https://github.com/kennethreitz/clint.git
synced 2026-06-05 23:00:18 +00:00
Added arguments example.
This commit is contained in:
@@ -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
|
||||
Executable
+12
@@ -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'
|
||||
Reference in New Issue
Block a user