summaryrefslogtreecommitdiffstats
path: root/deluge/ui/console/console.py
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/ui/console/console.py')
-rw-r--r--deluge/ui/console/console.py66
1 files changed, 44 insertions, 22 deletions
diff --git a/deluge/ui/console/console.py b/deluge/ui/console/console.py
index c95d675d0..893caf548 100644
--- a/deluge/ui/console/console.py
+++ b/deluge/ui/console/console.py
@@ -30,8 +30,12 @@ log = logging.getLogger(__name__)
def load_commands(command_dir):
def get_command(name):
- command = getattr(__import__('deluge.ui.console.cmdline.commands.%s' % name,
- {}, {}, ['Command']), 'Command')()
+ command = getattr(
+ __import__(
+ 'deluge.ui.console.cmdline.commands.%s' % name,
+ {}, {}, ['Command'],
+ ), 'Command',
+ )()
command._name = name
return command
@@ -67,29 +71,45 @@ class Console(UI):
def __init__(self, *args, **kwargs):
super(Console, self).__init__('console', *args, log_stream=LogStream(), **kwargs)
- group = self.parser.add_argument_group(_('Console Options'),
- _('These daemon connect options will be '
- 'used for commands, or if console ui autoconnect is enabled.'))
- group.add_argument('-d', '--daemon', metavar='<ip_addr>', dest='daemon_addr',
- help=_('Deluge daemon IP address to connect to (default 127.0.0.1)'), default='127.0.0.1')
- group.add_argument('-p', '--port', metavar='<port>', dest='daemon_port', type=int,
- help=_('Deluge daemon port to connect to (default 58846)'), default='58846')
- group.add_argument('-U', '--username', metavar='<user>', dest='daemon_user',
- help=_('Deluge daemon username to use when connecting'))
- group.add_argument('-P', '--password', metavar='<pass>', dest='daemon_pass',
- help=_('Deluge daemon password to use when connecting'))
+ group = self.parser.add_argument_group(
+ _('Console Options'),
+ _(
+ 'These daemon connect options will be '
+ 'used for commands, or if console ui autoconnect is enabled.',
+ ),
+ )
+ group.add_argument(
+ '-d', '--daemon', metavar='<ip_addr>', dest='daemon_addr',
+ help=_('Deluge daemon IP address to connect to (default 127.0.0.1)'), default='127.0.0.1',
+ )
+ group.add_argument(
+ '-p', '--port', metavar='<port>', dest='daemon_port', type=int,
+ help=_('Deluge daemon port to connect to (default 58846)'), default='58846',
+ )
+ group.add_argument(
+ '-U', '--username', metavar='<user>', dest='daemon_user',
+ help=_('Deluge daemon username to use when connecting'),
+ )
+ group.add_argument(
+ '-P', '--password', metavar='<pass>', dest='daemon_pass',
+ help=_('Deluge daemon password to use when connecting'),
+ )
# To properly print help message for the console commands ( e.g. deluge-console info -h),
# we add a subparser for each command which will trigger the help/usage when given
from deluge.ui.console.parser import ConsoleCommandParser # import here because (see top)
- self.console_parser = ConsoleCommandParser(parents=[self.parser], add_help=False, prog=self.parser.prog,
- description='Starts the Deluge console interface',
- formatter_class=lambda prog:
- DelugeTextHelpFormatter(prog, max_help_position=33, width=90))
+ self.console_parser = ConsoleCommandParser(
+ parents=[self.parser], add_help=False, prog=self.parser.prog,
+ description='Starts the Deluge console interface',
+ formatter_class=lambda prog:
+ DelugeTextHelpFormatter(prog, max_help_position=33, width=90),
+ )
self.parser.subparser = self.console_parser
self.console_parser.base_parser = self.parser
- subparsers = self.console_parser.add_subparsers(title=_('Console Commands'), help=_('Description'),
- description=_('The following console commands are available:'),
- metavar=_('Command'), dest='command')
+ subparsers = self.console_parser.add_subparsers(
+ title=_('Console Commands'), help=_('Description'),
+ description=_('The following console commands are available:'),
+ metavar=_('Command'), dest='command',
+ )
from deluge.ui.console import UI_PATH # Must import here
self.console_cmds = load_commands(os.path.join(UI_PATH, 'cmdline', 'commands'))
for cmd in sorted(self.console_cmds):
@@ -116,5 +136,7 @@ class Console(UI):
log.exception(ex)
raise
- return deluge.common.run_profiled(run, self.options, output_file=self.options.profile,
- do_profile=self.options.profile)
+ return deluge.common.run_profiled(
+ run, self.options, output_file=self.options.profile,
+ do_profile=self.options.profile,
+ )