summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/argparse_example.py4
-rwxr-xr-xexamples/pirate.py4
2 files changed, 4 insertions, 4 deletions
diff --git a/examples/argparse_example.py b/examples/argparse_example.py
index 48adca52..9f6548de 100755
--- a/examples/argparse_example.py
+++ b/examples/argparse_example.py
@@ -65,13 +65,13 @@ class CmdLineApp(Cmd):
do_orate = do_speak # another synonym, but this one takes multi-line input
tag_parser = argparse.ArgumentParser()
- tag_parser.add_argument('tag', nargs=1, help='tag')
+ tag_parser.add_argument('tag', help='tag')
tag_parser.add_argument('content', nargs='+', help='content to surround with tag')
@with_argument_parser(tag_parser)
def do_tag(self, args):
"""create a html tag"""
- self.poutput('<{0}>{1}</{0}>'.format(args.tag[0], ' '.join(args.content)))
+ self.poutput('<{0}>{1}</{0}>'.format(args.tag, ' '.join(args.content)))
@with_argument_list
diff --git a/examples/pirate.py b/examples/pirate.py
index 55457e06..dd9fd98c 100755
--- a/examples/pirate.py
+++ b/examples/pirate.py
@@ -76,7 +76,7 @@ class Pirate(Cmd):
yo_parser = argparse.ArgumentParser()
yo_parser.add_argument('--ho', type=int, default=2, help="How often to chant 'ho'")
yo_parser.add_argument('-c', '--commas', action='store_true', help='Intersperse commas')
- yo_parser.add_argument('beverage', nargs=1, help='beverage to drink with the chant')
+ yo_parser.add_argument('beverage', help='beverage to drink with the chant')
@with_argument_parser(yo_parser)
def do_yo(self, args):
@@ -84,7 +84,7 @@ class Pirate(Cmd):
chant = ['yo'] + ['ho'] * args.ho
separator = ', ' if args.commas else ' '
chant = separator.join(chant)
- print('{0} and a bottle of {1}'.format(chant, args.beverage[0]))
+ print('{0} and a bottle of {1}'.format(chant, args.beverage))
if __name__ == '__main__':