def dummy_bare(): parser.add_argument( '-t', '--test', default='wibble', ) yield print('in dummy_bare, args.test:', args.test)
def dummy(): parser.add_argument( '-v', '--verbose', action='store_true', default=False, help='output more stuff', ) yield g.number = 10 if args.verbose else 5
def dummy(): parser.add_argument( '-f', '--fail', action='store_true', default=False, help='fail without invoking the child command', ) yield if args.fail: yield 7
def bar(): parser.add_argument( '-f', '--fast', action='store_true', default=False, help='do it faster', ) yield join_character = '' if args.fast is True else ' ' print(join_character.join(['bar' for _ in range(g.number)]))
def foo(): parser.add_argument( '-l', '--loud', action='store_true', default=False, help='do it louder', ) yield msg = 'FOO' if args.loud is True else 'foo' print(' '.join([msg for _ in range(g.number)]))
def dummy(): print('configuring top-level parser') parser.add_argument( '-v', '--verbose', action='store_true', default=False, help='output more stuff', ) yield print('running the code after the yield in "dummy"')
def dummy(): parser.add_argument( '-v', '--verbose', action='store_true', default=False, help='output diagnostic information', ) yield if args.verbose: print('you chose verbose')
def bar(): print('configuring bar parser') parser.add_argument( '-f', '--fast', action='store_true', default=False, help='do it faster', ) yield print('running bar') join_character = '' if args.fast else ' ' number = 10 if args.verbose else 5 print(join_character.join(['bar' for _ in range(number)]))
def foo(): print('configuring foo parser') parser.add_argument( '-l', '--loud', action='store_true', default=False, help='do it louder', ) yield print('running foo') msg = 'FOO' if args.loud else 'foo' number = 10 if args.verbose else 5 print(' '.join([msg for _ in range(number)]))
def dummy(): parser.add_argument('test', nargs=1) yield