Add CLI related to channels + add comments to channels
Fixes: https://pagure.io/koji/issue/1711 Fixes: https://pagure.io/koji/issue/1849
This commit is contained in:
parent
ed2b0ad19b
commit
aec9fba121
18 changed files with 599 additions and 169 deletions
|
|
@ -298,6 +298,19 @@ def handle_remove_host_from_channel(goptions, session, args):
|
|||
session.removeHostFromChannel(host, channel)
|
||||
|
||||
|
||||
def handle_add_channel(goptions, session, args):
|
||||
"[admin] Add a channel"
|
||||
usage = _("usage: %prog add-channel [options] <channel_name>")
|
||||
parser = OptionParser(usage=get_usage_str(usage))
|
||||
parser.add_option("--description", help=_("Description of channel"))
|
||||
(options, args) = parser.parse_args(args)
|
||||
if len(args) != 1:
|
||||
parser.error(_("Please specify one channel name"))
|
||||
activate_session(session, goptions)
|
||||
channel_id = session.addChannel(args[0], description=options.description)
|
||||
print("%s added: id %d" % (args[0], channel_id))
|
||||
|
||||
|
||||
def handle_remove_channel(goptions, session, args):
|
||||
"[admin] Remove a channel entirely"
|
||||
usage = _("usage: %prog remove-channel [options] <channel>")
|
||||
|
|
@ -318,6 +331,8 @@ def handle_rename_channel(goptions, session, args):
|
|||
usage = _("usage: %prog rename-channel [options] <old-name> <new-name>")
|
||||
parser = OptionParser(usage=get_usage_str(usage))
|
||||
(options, args) = parser.parse_args(args)
|
||||
print("rename-channel is deprecated and will be removed in 1.28, this call is replaced by "
|
||||
"edit-channel")
|
||||
if len(args) != 2:
|
||||
parser.error(_("Incorrect number of arguments"))
|
||||
activate_session(session, goptions)
|
||||
|
|
@ -327,6 +342,19 @@ def handle_rename_channel(goptions, session, args):
|
|||
session.renameChannel(args[0], args[1])
|
||||
|
||||
|
||||
def handle_edit_channel(goptions, session, args):
|
||||
"[admin] Edit a channel"
|
||||
usage = _("usage: %prog edit-channel [options] <old-name>")
|
||||
parser = OptionParser(usage=get_usage_str(usage))
|
||||
parser.add_option("--name", help=_("New channel name"))
|
||||
parser.add_option("--description", help=_("Description of channel"))
|
||||
(options, args) = parser.parse_args(args)
|
||||
if len(args) != 1:
|
||||
parser.error(_("Incorrect number of arguments"))
|
||||
activate_session(session, goptions)
|
||||
session.editChannel(args[0], name=options.name, description=options.description)
|
||||
|
||||
|
||||
def handle_add_pkg(goptions, session, args):
|
||||
"[admin] Add a package to the listing for tag"
|
||||
usage = _("usage: %prog add-pkg [options] --owner <owner> <tag> <package> [<package> ...]")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue