Package gbp :: Package git :: Module args :: Class GitArgs

[hide private]
[frames] | no frames]

# Class GitArgs

    object --+
             |
            GitArgs

Handle arguments to git commands

    >>> GitArgs('-h', '--no-foo').args
    ['-h', '--no-foo']
    >>> GitArgs('-n', 123).args
    ['-n', '123']
    >>> GitArgs().add('--more-foo', '--less-bar').args
    ['--more-foo', '--less-bar']
    >>> GitArgs().add(['--foo', '--bar']).args
    ['--foo', '--bar']
    >>> GitArgs().add_cond(1 > 2, '--opt', '--no-opt').args
    ['--no-opt']
    >>> GitArgs().add_true(True, '--true').args
    ['--true']
    >>> GitArgs().add_false(True, '--true').args
    []
    >>> GitArgs().add_false(False, '--false').args
    ['--false']

Instance Methods | [hide private]

__init__(self, *args) x.__init__(...) initializes x; see help(type(x)) for signature |

add(self, *args) Add arguments to argument list |

add_true(self, condition, *args) Add args if condition is `True` |

add_false(self, condition, *args) Add args if condition is `False` |

add_cond(self, condition, opt, noopt=`[``]`) Add option opt to alist if condition is `True` else add noopt. |

Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties | [hide private]

| args
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, *args)
(Constructor)

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
  (inherited documentation)

### add_true(self, condition, *args)

Add args if condition is `True`

Parameters:
  - `condition` (`bool`) - the condition to test
  - `args` - arguments to add

### add_false(self, condition, *args)

Add args if condition is `False`

Parameters:
  - `condition` (`bool`) - the condition to test
  - `args` - arguments to add

### add_cond(self, condition, opt, noopt=`[``]`)

Add option opt to alist if condition is `True` else add noopt.

Parameters:
  - `condition` (`bool`) - condition
  - `opt` (`str` or `list`) - option to add if condition is `True`
  - `noopt` (`str` or `list`) - option to add if condition is `False`

Property Details | [hide private]

### args

Get Method:
  unreachable.args(self)