def getResourceArgs(self, commandLine):

    # Set defaults
    resourceName  = ""
    hasReleaseArg = False
    releaseName   = ""  

    # The command line begins with [gkno mode], so begin by popping these off the front.
    commandLine.pop(0)
    commandLine.pop(0)

    # If any args provided 
    if len(commandLine) > 0:
      
      # We require the first one to be a bare-word resource name
      if commandLine[0].startswith("-"):
        self.error.invalidResourceArgs(self.mode)
        self.error.terminate()
      resourceName = commandLine[0].lower()
      commandLine.pop(0)
      
      # Handle any additional args
      while ( len(commandLine) != 0 ):
        argument = commandLine.pop(0)

        # All of our args must start with '-'
        if not argument.startswith("-"):
          self.error.invalidResourceArgs(self.mode)
          self.error.terminate()

        # If arg is '--release' 
        if argument == "--release":

          # "update-resource" does not recognize '--release' arg
          if self.mode == "update-resource":
            self.error.invalidResourceArgs(self.mode)
            self.error.terminate()

          # Otherwise, set flag & see if a release name exists
          hasReleaseArg = True
          try: 
            releaseName = commandLine.pop(0).lower()
          except: 
            releaseName = ""

        # If arg is '--verbose' or '-vb', ignore it (we've already set our verbose-ness).
        elif argument == "--verbose" or argument == "-vb":
          continue

        # If arg is ( ADD ANY NEW ARG HANDLING HERE )

        # If argument unrecognized
        else:
          self.error.invalidResourceArgs(self.mode)
          self.error.terminate()
          
    # Return parsed results 
    return (resourceName, hasReleaseArg, releaseName)

  # Resolves resource alias
  #
  # If input is a normal resource name, just return it.
  # If input is an alias, return resource's actual name.
  # If input is not recognized, return empty string.
dataset/ETHPy150Open gkno/gkno_launcher/src/gkno/adminUtils.py/adminUtils.getResourceArgs/original