mirror of
https://github.com/kennethreitz-archive/plac.git
synced 2026-06-05 15:40:17 +00:00
19 lines
368 B
Python
19 lines
368 B
Python
# example12.py
|
|
import plac
|
|
|
|
@plac.annotations(
|
|
opt=('some option', 'option'),
|
|
args='default arguments',
|
|
kw='keyword arguments')
|
|
def main(opt, *args, **kw):
|
|
if opt:
|
|
yield 'opt=%s' % opt
|
|
if args:
|
|
yield 'args=%s' % str(args)
|
|
if kw:
|
|
yield 'kw=%s' % kw
|
|
|
|
if __name__ == '__main__':
|
|
for output in plac.call(main):
|
|
print(output)
|