3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-11 20:52:42 +01:00

networks.remote: don't clobber command switches for other commands

This also moves the --service argument to before the network name to prevent ambiguity with argparse.REMAINDER.

Closes #538.
This commit is contained in:
James Lu 2017-11-14 18:10:56 -08:00
parent f969197436
commit 52f40ad7a2

View File

@ -55,16 +55,20 @@ def autoconnect(irc, source, args):
irc.reply("Done.") irc.reply("Done.")
remote_parser = utils.IRCParser() remote_parser = utils.IRCParser()
remote_parser.add_argument('network')
remote_parser.add_argument('--service', type=str, default='pylink') remote_parser.add_argument('--service', type=str, default='pylink')
remote_parser.add_argument('command', nargs='+') remote_parser.add_argument('network')
remote_parser.add_argument('command', nargs=utils.IRCParser.REMAINDER)
@utils.add_cmd @utils.add_cmd
def remote(irc, source, args): def remote(irc, source, args):
"""<network> [--service <service name>] <command> """[--service <service name>] <network> <command>
Runs <command> on the remote network <network>. Plugin responses sent using irc.reply() are Runs <command> on the remote network <network>. Plugin responses sent using irc.reply() are
supported and returned here, but others are dropped due to protocol limitations.""" supported and returned here, but others are dropped due to protocol limitations."""
args = remote_parser.parse_args(args) args = remote_parser.parse_args(args)
if not args.command:
irc.error('No command given!')
return
netname = args.network netname = args.network
permissions.check_permissions(irc, source, [ permissions.check_permissions(irc, source, [