Commits

Anonymous committed 3342da2

add test

  • Participants
  • Parent commits b673ff8

Comments (0)

Files changed (1)

+# ex.py
+
+import caipyrinha
+
+parser = caipyrinha.Caipyrinha(prog="Your Program")
+parser.add_argument("--version", action='version', version="%(prog)s 0.1")
+
+@parser.callback(exit=0, exclusive="group1")
+def first(flags, returns):
+    '''Execute this option and exit'''
+    print "bye bye"
+
+@parser.callback(action="store")
+def second(flags, returns):
+    '''set his own return value with his parameter'''
+    return flags.second
+
+@parser.callback("--third", exclusive="group1")
+def no_used_name(flags, returns):
+    '''you cant use this argument with first'''
+    print returns.second
+
+import sys
+parser(sys.argv[1:])