Back to index

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

List of all members.

Public Member Functions

def __init__
def __str__

Public Attributes

 default
 has_default
 takes_argument
 prefix
 name
 help

Static Public Attributes

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

Detailed Description

Option that takes an argument.

    An optional default argument can be given.

Definition at line 194 of file CommandLine.py.


Constructor & Destructor Documentation

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

Definition at line 201 of file CommandLine.py.

00201 
00202     def __init__(self,name,help=None,default=None):
00203 
00204         # Basemethod
00205         Option.__init__(self,name,help)
00206 
00207         if default is not None:
00208             self.default = default
00209             self.has_default = 1
00210         self.takes_argument = 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 207 of file CommandLine.py.

Reimplemented from CommandLine.Option.

Definition at line 208 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.

Reimplemented from CommandLine.Option.

Definition at line 209 of file CommandLine.py.


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