parameters: ()
docstring: Parses the command-line arguments given by the user and takes the
      appropriate action for each
docstring_summary: Parses the command-line arguments given by the user and takes the
      appropriate action for each
docstring_tokens: Parses the command - line arguments given by the user and takes the appropriate action for each
function: def parse_args():
      '''Parses the command-line arguments given by the user and takes the
      appropriate action for each'''
      global b_flag
      global status_flag
      global force_flag
      global args
      if len(sys.argv) <= 1:
          usage()
          sys.exit(0)
  
      try:
          opts, args = getopt.getopt(sys.argv[1:], "b:u",
                                 ["help", "usage", "status", "force",
                                  "bind=", "unbind"])
      except getopt.GetoptError, error:
          print str(error)
          print "Run '%s --usage' for further information" % sys.argv[0]
          sys.exit(1)
  
      for opt, arg in opts:
          if opt == "--help" or opt == "--usage":
              usage()
              sys.exit(0)
          if opt == "--status":
              status_flag = True
          if opt == "--force":
              force_flag = True
          if opt == "-b" or opt == "-u" or opt == "--bind" or opt == "--unbind":
              if b_flag is not None:
                  print "Error - Only one bind or unbind may be specified\n"
                  sys.exit(1)
              if opt == "-u" or opt == "--unbind":
                  b_flag = "none"
              else:
                  b_flag = arg
function_tokens: def parse_args ( ) : global b_flag global status_flag global force_flag global args if len ( sys . argv ) <= 1 : usage ( ) sys . exit ( 0 ) try : opts , args = getopt . getopt ( sys . argv [ 1 : ] , "b:u" , [ "help" , "usage" , "status" , "force" , "bind=" , "unbind" ] ) except getopt . GetoptError , error : print str ( error ) print "Run '%s --usage' for further information" % sys . argv [ 0 ] sys . exit ( 1 ) for opt , arg in opts : if opt == "--help" or opt == "--usage" : usage ( ) sys . exit ( 0 ) if opt == "--status" : status_flag = True if opt == "--force" : force_flag = True if opt == "-b" or opt == "-u" or opt == "--bind" or opt == "--unbind" : if b_flag is not None : print "Error - Only one bind or unbind may be specified\n" sys . exit ( 1 ) if opt == "-u" or opt == "--unbind" : b_flag = "none" else : b_flag = arg