Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Static Public Attributes
CommandLine.SwitchOption Class Reference
Inheritance diagram for CommandLine.SwitchOption:
Inheritance graph
[legend]
Collaboration diagram for CommandLine.SwitchOption:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __str__

Public Attributes

 default
 has_default
 prefix
 name
 help

Static Public Attributes

string helptext = ''
string prefix = '-'
int takes_argument = 0
int tab = 15

Detailed Description

Options that can be on or off. Has an optional default value.

Definition at line 211 of file CommandLine.py.


Constructor & Destructor Documentation

def CommandLine.SwitchOption.__init__ (   self,
  name,
  help = None,
  default = None 
)

Definition at line 216 of file CommandLine.py.

00216 
00217     def __init__(self,name,help=None,default=None):
00218 
00219         # Basemethod
00220         Option.__init__(self,name,help)
00221 
00222         if default is not None:
00223             self.default = default
00224             self.has_default = 1

Here is the caller graph for this function:


Member Function Documentation

def CommandLine.Option.__str__ (   self) [inherited]

Definition at line 179 of file CommandLine.py.

00179 
00180     def __str__(self):
00181 
00182         o = self
00183         name = o.prefix + o.name
00184         if o.takes_argument:
00185             name = name + ' arg'
00186         if len(name) > self.tab:
00187             name = name + '\n' + ' ' * (self.tab + 1 + len(o.prefix))
00188         else:
00189             name = '%-*s ' % (self.tab, name)
00190         description = o.help
00191         if o.has_default:
00192             description = description + ' (%s)' % o.default
00193         return '%s %s' % (name, description)


Member Data Documentation

Reimplemented from CommandLine.Option.

Definition at line 222 of file CommandLine.py.

Reimplemented from CommandLine.Option.

Definition at line 223 of file CommandLine.py.

Definition at line 177 of file CommandLine.py.

string CommandLine.Option.helptext = '' [static, inherited]

Definition at line 161 of file CommandLine.py.

Definition at line 173 of file CommandLine.py.

string CommandLine.Option.prefix = '-' [static, inherited]

Definition at line 162 of file CommandLine.py.

Definition at line 172 of file CommandLine.py.

int CommandLine.Option.tab = 15 [static, inherited]

Definition at line 165 of file CommandLine.py.

int CommandLine.Option.takes_argument = 0 [static, inherited]

Reimplemented in CommandLine.ArgumentOption.

Definition at line 163 of file CommandLine.py.


The documentation for this class was generated from the following file: