mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-26 09:56:13 +01:00
- meta: add --delete switch to delete pattern files
- complete last fix (don't implicitely add .xml to pattern files) -- forgot to commit the part in osc/core.py.
This commit is contained in:
parent
1945a7a683
commit
de9faebefe
@ -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 <prj|pkg|prjconf|user|pattern> ARGS...
|
||||
osc meta <prj|pkg|prjconf|user|pattern> -e|--edit [-c|--create] ARGS...
|
||||
osc meta <prj|pkg|prjconf|user|pattern> -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}
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user