Revision acd19189 lib/cli.py

b/lib/cli.py
178 178
  "ToStderr", "ToStdout",
179 179
  "FormatError",
180 180
  "FormatQueryResult",
181
  "FormatParameterDict",
181 182
  "GenerateTable",
182 183
  "AskUser",
183 184
  "FormatTimestamp",
......
2941 2942
        else:
2942 2943
          ToStderr("Failure for %s: %s", name, result)
2943 2944
      return [row[1:3] for row in self.jobs]
2945

  
2946

  
2947
def FormatParameterDict(buf, param_dict, actual, level=1):
2948
  """Formats a parameter dictionary.
2949

  
2950
  @type buf: L{StringIO}
2951
  @param buf: the buffer into which to write
2952
  @type param_dict: dict
2953
  @param param_dict: the own parameters
2954
  @type actual: dict
2955
  @param actual: the current parameter set (including defaults)
2956
  @param level: Level of indent
2957

  
2958
  """
2959
  indent = "  " * level
2960
  for key in sorted(actual):
2961
    val = param_dict.get(key, "default (%s)" % actual[key])
2962
    buf.write("%s- %s: %s\n" % (indent, key, val))

Also available in: Unified diff