diff --git a/osc/commandline.py b/osc/commandline.py index 5f388f75..edc17ed5 100755 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -137,6 +137,8 @@ class Osc(cmdln.Cmdln): '\'-\' denotes standard input. ') @cmdln.option('-e', '--edit', action='store_true', help='edit metadata') + @cmdln.option('--delete', action='store_true', + help='delete a pattern file') def do_meta(self, subcmd, opts, *args): """${cmd_name}: Show meta information, or edit it @@ -169,6 +171,7 @@ class Osc(cmdln.Cmdln): osc meta ARGS... osc meta -e|--edit [-c|--create] ARGS... osc meta -F|--file ARGS... + osc meta pattern --delete PRJ PATTERN ${cmd_option_list} """ @@ -214,7 +217,7 @@ class Osc(cmdln.Cmdln): sys.exit('a pattern file argument is required.') # show - if not opts.edit and not opts.file: + if not opts.edit and not opts.file and not opts.delete: if cmd == 'prj': sys.stdout.write(''.join(show_project_meta(conf.config['apiurl'], project))) elif cmd == 'pkg': @@ -301,6 +304,16 @@ class Osc(cmdln.Cmdln): path_args=(project, pattern)) + # delete + if opts.delete: + path = metatypes[cmd]['path'] + if cmd == 'pattern': + path = path % (project, pattern) + u = makeurl(conf.config['apiurl'], [path]) + else: + sys.exit('The --delete switch is only for pattern metadata.') + + # editmeta and its aliases are all depracated @cmdln.alias("editprj") @@ -438,7 +451,7 @@ class Osc(cmdln.Cmdln): def do_deletepac(self, subcmd, opts, project, package): - """${cmd_name}: Delete a packge on the repository server + """${cmd_name}: Delete a package on the repository server ${cmd_usage} ${cmd_option_list} diff --git a/osc/core.py b/osc/core.py index d63a2bca..c05c36da 100755 --- a/osc/core.py +++ b/osc/core.py @@ -914,7 +914,6 @@ def show_pattern_metalist(apiurl, prj): f = http_GET(url) tree = ET.parse(f) r = [ node.get('name') for node in tree.getroot() ] - r = [ os.path.splitext(i)[0] for i in r ] r.sort() return r