diff --git a/osc/commandline.py b/osc/commandline.py index eb3c7f26..701ddb48 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -1623,6 +1623,8 @@ Please submit there instead, or use --nodevelproject to force direct submission. help='only show requests created by yourself') @cmdln.option('-B', '--bugowner', action='store_true', help='also show requests about packages where I am bugowner') + @cmdln.option('-e', '--edit', action='store_true', + help='edit a submit action') @cmdln.option('-i', '--interactive', action='store_true', help='interactive review of request') @cmdln.option('--non-interactive', action='store_true', @@ -1886,6 +1888,11 @@ Please submit there instead, or use --nodevelproject to force direct submission. r = get_request(apiurl, reqid) if opts.brief: print r.list_view() + elif opts.edit: + if not r.get_actions('submit'): + raise oscerr.WrongOptions('\'--edit\' not possible ' \ + '(request has no \'submit\' action)') + return request_interactive_review(apiurl, r, 'e') elif (opts.interactive or conf.config['request_show_interactive']) and not opts.non_interactive: return request_interactive_review(apiurl, r) else: diff --git a/osc/core.py b/osc/core.py index a1396555..dade1920 100644 --- a/osc/core.py +++ b/osc/core.py @@ -5912,7 +5912,7 @@ def print_request_list(apiurl, project, package = None, states = ('new', ), forc for r in requests: print r.list_view(), '\n' -def request_interactive_review(apiurl, request): +def request_interactive_review(apiurl, request, initial_cmd=''): """review the request interactively""" import tempfile, re @@ -5935,7 +5935,11 @@ def request_interactive_review(apiurl, request): editprj = '' orequest = None while True: - repl = raw_input(prompt).strip() + if initial_cmd: + repl = initial_cmd + initial_cmd = '' + else: + repl = raw_input(prompt).strip() if repl == 'i' and sr_actions: if not orequest is None and tmpfile: tmpfile.close()