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):
|
159 | 159 | |
160 | 160 | # Set the interactive flag to indicate where we should print the output |
161 | 161 | self.interactive = True |
| 162 | connect_cmd = 'connect' |
162 | 163 | if args: |
163 | 164 | # Multiple commands split by ";" |
164 | 165 | 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) |
166 | 173 | |
167 | 174 | # Try to connect to the daemon (localhost by default) |
168 | 175 | def on_connect(result): |
… |
… |
def on_connect_fail(result):
|
189 | 196 | if not self.interactive: |
190 | 197 | self.do_command('quit') |
191 | 198 | |
192 | | connect_cmd = 'connect' |
193 | 199 | 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: |
197 | 201 | self.do_command('help') |
198 | 202 | return |
199 | 203 | d = self.do_command(connect_cmd) |