Overview

Packages

  • Argv

Classes

  • Horde_Argv_AmbiguousOptionException
  • Horde_Argv_BadOptionException
  • Horde_Argv_Exception
  • Horde_Argv_HelpFormatter
  • Horde_Argv_IndentedHelpFormatter
  • Horde_Argv_Option
  • Horde_Argv_OptionConflictException
  • Horde_Argv_OptionContainer
  • Horde_Argv_OptionException
  • Horde_Argv_OptionGroup
  • Horde_Argv_OptionValueException
  • Horde_Argv_Parser
  • Horde_Argv_TitledHelpFormatter
  • Horde_Argv_Translation
  • Horde_Argv_Values
  • Overview
  • Package
  • Class
  • Tree

Class Horde_Argv_HelpFormatter

Abstract base class for formatting option help. Horde_Argv_Parser instances should use one of the HelpFormatter subclasses for formatting help; by default IndentedHelpFormatter is used.

Instance attributes: parser : Horde_Argv_Parser the controlling Horde_Argv_Parser instance indent_increment : int the number of columns to indent per nesting level max_help_position : int the maximum starting column for option help text help_position : int the calculated starting column for option help text; initially the same as the maximum width : int total number of columns for output (pass None to constructor for this value to be taken from the $COLUMNS environment variable) level : int current indentation level current_indent : int current indentation level (in columns) help_width : int number of columns available for option help text (calculated) default_tag : str text to replace with each option's default value, "%default" by default. Set to false value to disable default value expansion. option_strings : { Option : str } maps Option instances to the snippet of help text explaining the syntax of that option, e.g. "-h, --help" or "-fFILE, --file=FILE" _short_opt_fmt : str format string controlling how short options with values are printed in help text. Must be either "%s%s" ("-fFILE") or "%s %s" ("-f FILE"), because those are the two syntaxes that Horde_Argv supports. _long_opt_fmt : str similar but for long options; must be either "%s %s" ("--file FILE") or "%s=%s" ("--file=FILE").

Direct known subclasses

Horde_Argv_IndentedHelpFormatter, Horde_Argv_TitledHelpFormatter
Abstract
Package: Argv
Category: Horde
Located at Horde/Argv/HelpFormatter.php
Methods summary
public
# __construct( mixed $indent_increment, mixed $max_help_position, mixed $width = null, mixed $short_first = false )
public
# setParser( mixed $parser )
public
# setShortOptDelimiter( mixed $delim )
public
# setLongOptDelimiter( mixed $delim )
public
# indent( )
public
# dedent( )
abstract public
# formatUsage( mixed $usage )
abstract public
# formatHeading( mixed $heading )
public
# formatDescription( mixed $description )
public
# formatEpilog( mixed $epilog )
public
# expandDefault( mixed $option )
public
# formatOption( mixed $option )

The help for each option consists of two parts: * the opt strings and metavars eg. ("-x", or "-fFILENAME, --file=FILENAME") * the user-supplied help string eg. ("turn on expert mode", "read data from FILENAME")

The help for each option consists of two parts: * the opt strings and metavars eg. ("-x", or "-fFILENAME, --file=FILENAME") * the user-supplied help string eg. ("turn on expert mode", "read data from FILENAME")

If possible, we write both of these on the same line: -x turn on expert mode

But if the opt string list is too long, we put the help string on a second line, indented to the same column it would start in if it fit on the first line. -fFILENAME, --file=FILENAME read data from FILENAME

public
# storeOptionStrings( mixed $parser )
public
# formatOptionStrings( mixed $option )

Return a comma-separated list of option strings & metavariables.

Return a comma-separated list of option strings & metavariables.

Constants summary
string NO_DEFAULT_VALUE
# 'none'
Properties summary
public mixed $parser
# null
API documentation generated by ApiGen