4Suite API Documentation: Ft.Lib.CommandLine.Command

4Suite™ API Documentation

# ► Module Ft.Lib.CommandLine.Command

Superclass for a command that can be invoked by a command-line script.

    Copyright 2004 Fourthought, Inc. (USA).
    Detailed license and copyright information: http://4suite.org/COPYRIGHT
    Project home, documentation, distributions: http://4suite.org/

Classes: Command |  |  |  | Globals: CONSOLE_WIDTH

## Classes

class Command
  Superclass for a command that can be invoked by a command-line script. Most commands won't need to subclass this.

      A Command object encapsulates, for a particular command, a description,
      usage example, a set of valid options & arguments, methods for
      validating the actual options and arguments entered, a function for
      command invocation, and an association with subordinate Commands.

      A tree of commands can be created by associating each Command instance
      with its subordinates. Typically, only the leaves of the tree will have
      functionality; the branches just provide ways of grouping the leaves
      and will not need to encapsulate the invocation functions themselves.

  ### Methods

  __init__(self, name, description, example, verbose_description, function=None, options=None, arguments=None, subCommands=None, fileName=None)
  break_parent_relationship(self)
  build_parent_relationship(self)
  flatten_command_tree(self, level, previousName='')
  run(self, options, arguments)
  validate_arguments(self, arglist)
  validate_options(self, options)

## Globals

CONSOLE_WIDTH = 236