##// END OF EJS Templates
Fix another small bug in stripping kernel args...
MinRK -
Show More
@@ -327,20 +327,23 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
327 super(IPythonQtConsoleApp, self).parse_command_line(argv)
327 super(IPythonQtConsoleApp, self).parse_command_line(argv)
328 if argv is None:
328 if argv is None:
329 argv = sys.argv[1:]
329 argv = sys.argv[1:]
330
331 self.kernel_argv = list(argv) # copy
330 self.kernel_argv = list(argv) # copy
332 # kernel should inherit default config file from frontend
331 # kernel should inherit default config file from frontend
333 self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name)
332 self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name)
334 # Scrub frontend-specific flags
333 # Scrub frontend-specific flags
335 for a in argv:
336 if a.startswith('-') and a.lstrip('-') in qt_flags:
337 self.kernel_argv.remove(a)
338 swallow_next = False
334 swallow_next = False
335 was_flag = False
336 # copy again, in case some aliases have the same name as a flag
337 # argv = list(self.kernel_argv)
339 for a in argv:
338 for a in argv:
340 if swallow_next:
339 if swallow_next:
341 self.kernel_argv.remove(a)
342 swallow_next = False
340 swallow_next = False
343 continue
341 # last arg was an alias, remove the next one
342 # *unless* the last alias has a no-arg flag version, in which
343 # case, don't swallow the next arg if it's also a flag:
344 if not (was_flag and a.startswith('-')):
345 self.kernel_argv.remove(a)
346 continue
344 if a.startswith('-'):
347 if a.startswith('-'):
345 split = a.lstrip('-').split('=')
348 split = a.lstrip('-').split('=')
346 alias = split[0]
349 alias = split[0]
@@ -349,6 +352,12 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
349 if len(split) == 1:
352 if len(split) == 1:
350 # alias passed with arg via space
353 # alias passed with arg via space
351 swallow_next = True
354 swallow_next = True
355 # could have been a flag that matches an alias, e.g. `existing`
356 # in which case, we might not swallow the next arg
357 was_flag = alias in qt_flags
358 elif alias in qt_flags:
359 # strip flag, but don't swallow next, as flags don't take args
360 self.kernel_argv.remove(a)
352
361
353 def init_connection_file(self):
362 def init_connection_file(self):
354 """find the connection file, and load the info if found.
363 """find the connection file, and load the info if found.
General Comments 0
You need to be logged in to leave comments. Login now