Revision 334d1483

b/lib/cli.py
240 240
  return proc.ExecOpCode(op, logger.ToStdout)
241 241

  
242 242

  
243
def GenericMain(commands):
243
def GenericMain(commands, override=None):
244 244
  """Generic main function for all the gnt-* commands.
245 245

  
246
  Argument: a dictionary with a special structure, see the design doc
247
  for command line handling.
246
  Arguments:
247
    - commands: a dictionary with a special structure, see the design doc
248
                for command line handling.
249
    - override: if not None, we expect a dictionary with keys that will
250
                override command line options; this can be used to pass
251
                options from the scripts to generic functions
248 252

  
249 253
  """
250 254
  # save the program name and the entire command line for later logging
......
263 267
  if func is None: # parse error
264 268
    return 1
265 269

  
270
  if override is not None:
271
    for key, val in override.iteritems():
272
      setattr(options, key, val)
273

  
266 274
  logger.SetupLogging(debug=options.debug, program=binary)
267 275

  
268 276
  try:

Also available in: Unified diff