Skip to content

Commit

Permalink
- osc.cli.description: removed the "args_opt" and "_optional_argument…
Browse files Browse the repository at this point in the history
…s" cruft

Adjusted commands to use the extended oargs syntax instead.
  • Loading branch information
marcus-h committed Jan 18, 2013
1 parent 6c6500f commit f23c47e
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 30 deletions.
3 changes: 1 addition & 2 deletions osc/cli/commit/ui.py
Expand Up @@ -16,7 +16,6 @@ class Commit(CommandDescription, OscCommand):
"""
cmd = 'commit'
args = 'wc_path'
args_opt = [0]
args = '(wc_path)?'
opt_message = Option('m', 'message', 'specify a message')
func = call(WCCommitController().commit)
22 changes: 0 additions & 22 deletions osc/cli/description.py
Expand Up @@ -145,10 +145,6 @@ class AbstractCommandDescription(object):

cmd = None
args = None
# list which contains indices of optional positional args
# (use case: the cmd is context sensitive so a positional argument
# can be omitted)
args_opt = None
use_wc = False # set to True if command is context sensitive
help_str = None
func = None # function/callable which should be executed
Expand Down Expand Up @@ -205,24 +201,6 @@ def _parse_extended_oargs(cls, eoargs):
nargs = int(nargs)
yield m.group(1), trans.get(nargs, nargs)

@classmethod
def _optional_arguments(cls, oargs):
"""Returns a list which contains optional arguments.
oargs is a list of oargs str.
A ValueError is raised if cls.args_opt references an
index which does not fit into oargs' bounds.
"""
args_opt = []
for i in cls.args_opt or []:
try:
args_opt.append(oargs[i])
except IndexError:
msg = "args_opt: illegal index '%s' (out of bounds)" % i
raise ValueError(msg)
return args_opt

@classmethod
def _options(cls):
"""Yields a Option instance (if available)."""
Expand Down
3 changes: 1 addition & 2 deletions osc/cli/list/ui.py
Expand Up @@ -15,8 +15,7 @@ class List(CommandDescription, OscCommand):
"""
cmd = 'list'
args = 'api://project?/package?'
args_opt = [0]
args = '(api://project?/package?)?'
use_wc = True
opt_verbose = Option('v', 'verbose', 'verbose listing (for files only)',
action='store_true')
Expand Down
3 changes: 1 addition & 2 deletions osc/cli/status/ui.py
Expand Up @@ -16,8 +16,7 @@ class Status(CommandDescription, OscCommand):
"""
cmd = 'status'
args = 'wc_path'
args_opt = [0]
args = '(wc_path)?'
opt_verbose = Option('v', 'verbose', 'also print unchanged states',
action='store_true')
func = call(status)
3 changes: 1 addition & 2 deletions osc/cli/update/ui.py
Expand Up @@ -15,8 +15,7 @@ class Update(CommandDescription, OscCommand):
"""
cmd = 'update'
args = 'wc_path'
args_opt = [0]
args = '(wc_path)?'
opt_expand = Option('u', 'unexpand', 'do not expand a source link',
action='store_true')
opt_revision = Option('r', 'revision', 'list revision',
Expand Down

0 comments on commit f23c47e

Please sign in to comment.