Ticket #3217: deluge-conn.patch

File deluge-conn.patch, 1.4 KB (added by nayfield, 6 years ago)

Minimal patch to implement feature request

  • deluge/ui/console/main.py

    diff --git a/deluge/ui/console/main.py b/deluge/ui/console/main.py
    index 559d7ab47..e8ba227c8 100644
    a b def __init__(self, args=None):  
    159159
    160160        # Set the interactive flag to indicate where we should print the output
    161161        self.interactive = True
     162        connect_cmd = 'connect'
    162163        if args:
    163164            # Multiple commands split by ";"
    164165            commands = [arg.strip() for arg in ' '.join(args).split(';')]
    165             self.interactive = False
     166            if len(commands) == 1 and commands[0].startswith(connect_cmd):
     167                # If the only argument is connect, go interactive
     168                self.interactive = True
     169            else:
     170                self.interactive = False
     171            if commands[0].startswith(connect_cmd):
     172                connect_cmd = commands.pop(0)
    166173
    167174        # Try to connect to the daemon (localhost by default)
    168175        def on_connect(result):
    def on_connect_fail(result):  
    189196            if not self.interactive:
    190197                self.do_command('quit')
    191198
    192         connect_cmd = 'connect'
    193199        if not self.interactive:
    194             if commands[0].startswith(connect_cmd):
    195                 connect_cmd = commands.pop(0)
    196             elif 'help' in commands:
     200            if 'help' in commands:
    197201                self.do_command('help')
    198202                return
    199203        d = self.do_command(connect_cmd)