#!/usr/bin/env python
import optparse
import yaml
def main():
    """ Runs program and handles command line options """
    p = optparse.OptionParser(
        description= 'module manager for madlib',
        prog='madmod',
        version='madmod 0.1',
        usage='%prog [init|add|remove|list]')
    p.add_option('-i','--init',action='store_true',help='initialize the destination folder of module')
    p.add_option('-d','--add',action='store_true',help='add the destination folder of module')
    p.add_option('-l','--list',action='store_true',help='list all modules in configure file')
    p.add_option('-p','--prefix',action='store_true',help='set the prefix of path for config file')
    options,arguments = p.parse_args()
    if len(arguments) < 1:
        print "Warning:Missing arguments! Please check the usage:"
        p.print_help()
    else:
        if len(arguments) == 1 :
            print (arguments)
        if options.prefix:
            print arguments
            
if __name__ == '__main__':
    main()

@@ -22,19 +22,19 @@
 %0Aimport 
-opt
+arg
 parse%0Aim
@@ -125,23 +125,25 @@
 p = 
-opt
+arg
 parse.
-Option
+Argument
 Pars
@@ -223,38 +223,8 @@
 d',%0A
-        version='madmod 0.1',%0A
     
@@ -239,34 +239,24 @@
 e='%25
+(
 prog
- %5Binit%7Cadd%7Cremove%7Clist
+)s %5Boptions
 %5D')%0A
@@ -269,20 +269,17 @@
 add_
-option('-i',
+argument(
 '--i
@@ -288,37 +288,32 @@
 t',action='store
-_true
 ',help='initiali
@@ -364,20 +364,17 @@
 add_
-option('-d',
+argument(
 '--a
@@ -382,37 +382,32 @@
 d',action='store
-_true
 ',help='add the 
@@ -451,20 +451,17 @@
 add_
-option('-l',
+argument(
 '--l
@@ -542,20 +542,17 @@
 add_
-option('-p',
+argument(
 '--p
@@ -563,37 +563,32 @@
 x',action='store
-_true
 ',help='set the 
@@ -628,300 +628,22 @@
     
-options,arguments = p.parse_args()%0A    if len(arguments) %3C 1:%0A        print %22Warning:Missing arguments! Please check the usage:%22%0A        p.print_help()%0A    else:%0A        if len(arguments) == 1 :%0A            print (arguments)%0A        if options.prefix:%0A            print arguments%0A            
+p.print_help()
 %0Aif 

switch to argparse