##// END OF EJS Templates
Fix another small bug in stripping kernel args...
MinRK -
Show More
@@ -222,19 +222,22 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
222 super(IPythonQtConsoleApp, self).parse_command_line(argv)
222 super(IPythonQtConsoleApp, self).parse_command_line(argv)
223 if argv is None:
223 if argv is None:
224 argv = sys.argv[1:]
224 argv = sys.argv[1:]
225
226 self.kernel_argv = list(argv) # copy
225 self.kernel_argv = list(argv) # copy
227 # kernel should inherit default config file from frontend
226 # kernel should inherit default config file from frontend
228 self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name)
227 self.kernel_argv.append("--KernelApp.parent_appname='%s'"%self.name)
229 # Scrub frontend-specific flags
228 # Scrub frontend-specific flags
230 for a in argv:
231 if a.startswith('-') and a.lstrip('-') in qt_flags:
232 self.kernel_argv.remove(a)
233 swallow_next = False
229 swallow_next = False
230 was_flag = False
231 # copy again, in case some aliases have the same name as a flag
232 # argv = list(self.kernel_argv)
234 for a in argv:
233 for a in argv:
235 if swallow_next:
234 if swallow_next:
236 self.kernel_argv.remove(a)
237 swallow_next = False
235 swallow_next = False
236 # last arg was an alias, remove the next one
237 # *unless* the last alias has a no-arg flag version, in which
238 # case, don't swallow the next arg if it's also a flag:
239 if not (was_flag and a.startswith('-')):
240 self.kernel_argv.remove(a)
238 continue
241 continue
239 if a.startswith('-'):
242 if a.startswith('-'):
240 split = a.lstrip('-').split('=')
243 split = a.lstrip('-').split('=')
@@ -244,6 +247,12 b' class IPythonQtConsoleApp(BaseIPythonApplication):'
244 if len(split) == 1:
247 if len(split) == 1:
245 # alias passed with arg via space
248 # alias passed with arg via space
246 swallow_next = True
249 swallow_next = True
250 # could have been a flag that matches an alias, e.g. `existing`
251 # in which case, we might not swallow the next arg
252 was_flag = alias in qt_flags
253 elif alias in qt_flags:
254 # strip flag, but don't swallow next, as flags don't take args
255 self.kernel_argv.remove(a)
247
256
248 def init_connection_file(self):
257 def init_connection_file(self):
249 """find the connection file, and load the info if found.
258 """find the connection file, and load the info if found.
General Comments 0
You need to be logged in to leave comments. Login now