parameters: (args, new_name)
return_statement: return args
docstring: Replaces the specified name of an output file with the specified name.
      Assumes that the output file name is specified in the command line args.
docstring_summary: Replaces the specified name of an output file with the specified name.
      Assumes that the output file name is specified in the command line args.
docstring_tokens: Replaces the specified name of an output file with the specified name . Assumes that the output file name is specified in the command line args .
function: def replace_output_file(args, new_name):
      """Replaces the specified name of an output file with the specified name.
      Assumes that the output file name is specified in the command line args."""
      replaceidx = None
      attached = False
      for idx, val in enumerate(args):
          if val == '-o':
              replaceidx = idx + 1
              attached = False
          elif val.startswith('-o'):
              replaceidx = idx
              attached = True
  
      if replaceidx is None:
          raise Exception
      replacement = new_name
      if attached == True:
          replacement = '-o' + new_name
      args[replaceidx] = replacement
      return args
function_tokens: def replace_output_file ( args , new_name ) : replaceidx = None attached = False for idx , val in enumerate ( args ) : if val == '-o' : replaceidx = idx + 1 attached = False elif val . startswith ( '-o' ) : replaceidx = idx attached = True if replaceidx is None : raise Exception replacement = new_name if attached == True : replacement = '-o' + new_name args [ replaceidx ] = replacement return args