parameters: (self, argv=None)
docstring: Parse the command line arguments.
docstring_summary: Parse the command line arguments.
docstring_tokens: Parse the command line arguments .
function: def parse_command_line(self, argv=None):
          """Parse the command line arguments."""
          argv = sys.argv[1:] if argv is None else argv
          self.argv = [ py3compat.cast_unicode(arg) for arg in argv ]
  
          if argv and argv[0] == 'help':
              # turn `ipython help notebook` into `ipython notebook -h`
              argv = argv[1:] + ['-h']
  
          if self.subcommands and len(argv) > 0:
              # we have subcommands, and one may have been specified
              subc, subargv = argv[0], argv[1:]
              if re.match(r'^\w(\-?\w)*$', subc) and subc in self.subcommands:
                  # it's a subcommand, and *not* a flag or class parameter
                  return self.initialize_subcommand(subc, subargv)
  
          # Arguments after a '--' argument are for the script IPython may be
          # about to run, not IPython iteslf. For arguments parsed here (help and
          # version), we want to only search the arguments up to the first
          # occurrence of '--', which we're calling interpreted_argv.
          try:
              interpreted_argv = argv[:argv.index('--')]
          except ValueError:
              interpreted_argv = argv
  
          if any(x in interpreted_argv for x in ('-h', '--help-all', '--help')):
              self.print_help('--help-all' in interpreted_argv)
              self.exit(0)
  
          if '--version' in interpreted_argv or '-V' in interpreted_argv:
              self.print_version()
              self.exit(0)
  
          # flatten flags&aliases, so cl-args get appropriate priority:
          flags,aliases = self.flatten_flags()
          loader = KVArgParseConfigLoader(argv=argv, aliases=aliases,
                                          flags=flags, log=self.log)
          self.cli_config = deepcopy(loader.load_config())
          self.update_config(self.cli_config)
          # store unparsed args in extra_args
          self.extra_args = loader.extra_args
function_tokens: def parse_command_line ( self , argv = None ) : argv = sys . argv [ 1 : ] if argv is None else argv self . argv = [ py3compat . cast_unicode ( arg ) for arg in argv ] if argv and argv [ 0 ] == 'help' : # turn `ipython help notebook` into `ipython notebook -h` argv = argv [ 1 : ] + [ '-h' ] if self . subcommands and len ( argv ) > 0 : # we have subcommands, and one may have been specified subc , subargv = argv [ 0 ] , argv [ 1 : ] if re . match ( r'^\w(\-?\w)*$' , subc ) and subc in self . subcommands : # it's a subcommand, and *not* a flag or class parameter return self . initialize_subcommand ( subc , subargv ) # Arguments after a '--' argument are for the script IPython may be # about to run, not IPython iteslf. For arguments parsed here (help and # version), we want to only search the arguments up to the first # occurrence of '--', which we're calling interpreted_argv. try : interpreted_argv = argv [ : argv . index ( '--' ) ] except ValueError : interpreted_argv = argv if any ( x in interpreted_argv for x in ( '-h' , '--help-all' , '--help' ) ) : self . print_help ( '--help-all' in interpreted_argv ) self . exit ( 0 ) if '--version' in interpreted_argv or '-V' in interpreted_argv : self . print_version ( ) self . exit ( 0 ) # flatten flags&aliases, so cl-args get appropriate priority: flags , aliases = self . flatten_flags ( ) loader = KVArgParseConfigLoader ( argv = argv , aliases = aliases , flags = flags , log = self . log ) self . cli_config = deepcopy ( loader . load_config ( ) ) self . update_config ( self . cli_config ) # store unparsed args in extra_args self . extra_args = loader . extra_args