parameters: (argv)
return_statement: return main(["--help"])
docstring: This is the main function for the Mesos CLI.
docstring_summary: This is the main function for the Mesos CLI.
docstring_tokens: This is the main function for the Mesos CLI .
function: def main(argv):
      """
      This is the main function for the Mesos CLI.
      """
  
      # Load the CLI config.
      config = cli.config.Config(settings)
  
      plugins = cli.util.import_modules(
          cli.util.join_plugin_paths(settings, config),
          "plugins")
  
      cmds = {
          cli.util.get_module(plugins, plugin).PLUGIN_NAME:
          cli.util.get_module(plugins, plugin).SHORT_HELP
          for plugin in list(plugins.keys())
      }
  
      # Parse all incoming arguments using docopt.
      command_strings = ""
      if cmds != {}:
          command_strings = cli.util.format_commands_help(cmds)
      usage = USAGE.format(commands=command_strings)
  
      arguments = docopt(usage, argv=argv, version=VERSION, options_first=True)
  
      cmd = arguments["<command>"]
      argv = arguments["<args>"]
  
      # Use the meta-command `__autocomplete__` to perform
      # autocompletion on the remaining arguments.
      if cmd == "__autocomplete__":
          option = "default"
          comp_words = []
  
          # If there is an error performing the autocomplete, treat it
          # as if we were just unable to complete any words. This avoids
          # passing the erroring stack trace back as the list of words
          # to complete on.
          try:
              option, comp_words = autocomplete(cmds, plugins, config, argv)
          except Exception:
              pass
  
          print(option)
          print(" ".join(comp_words))
          return 0
  
      # Use the meta-command "help" to print help information for the
      # supplied command and its subcommands.
      if cmd == "help":
          if argv and argv[0] in cmds:
              plugin = cli.util.get_module(plugins, argv[0])
              plugin_class = getattr(plugin, plugin.PLUGIN_CLASS)
              return plugin_class(settings, config).main(argv[1:] + ["--help"])
  
          return main(["--help"])
  
      # Run the command through its plugin.
      if cmd in list(cmds.keys()):
          plugin = cli.util.get_module(plugins, cmd)
          plugin_class = getattr(plugin, plugin.PLUGIN_CLASS)
          return plugin_class(settings, config).main(argv)
  
      # Print help information if no commands match.
      return main(["--help"])
function_tokens: def main ( argv ) : # Load the CLI config. config = cli . config . Config ( settings ) plugins = cli . util . import_modules ( cli . util . join_plugin_paths ( settings , config ) , "plugins" ) cmds = { cli . util . get_module ( plugins , plugin ) . PLUGIN_NAME : cli . util . get_module ( plugins , plugin ) . SHORT_HELP for plugin in list ( plugins . keys ( ) ) } # Parse all incoming arguments using docopt. command_strings = "" if cmds != { } : command_strings = cli . util . format_commands_help ( cmds ) usage = USAGE . format ( commands = command_strings ) arguments = docopt ( usage , argv = argv , version = VERSION , options_first = True ) cmd = arguments [ "<command>" ] argv = arguments [ "<args>" ] # Use the meta-command `__autocomplete__` to perform # autocompletion on the remaining arguments. if cmd == "__autocomplete__" : option = "default" comp_words = [ ] # If there is an error performing the autocomplete, treat it # as if we were just unable to complete any words. This avoids # passing the erroring stack trace back as the list of words # to complete on. try : option , comp_words = autocomplete ( cmds , plugins , config , argv ) except Exception : pass print ( option ) print ( " " . join ( comp_words ) ) return 0 # Use the meta-command "help" to print help information for the # supplied command and its subcommands. if cmd == "help" : if argv and argv [ 0 ] in cmds : plugin = cli . util . get_module ( plugins , argv [ 0 ] ) plugin_class = getattr ( plugin , plugin . PLUGIN_CLASS ) return plugin_class ( settings , config ) . main ( argv [ 1 : ] + [ "--help" ] ) return main ( [ "--help" ] ) # Run the command through its plugin. if cmd in list ( cmds . keys ( ) ) : plugin = cli . util . get_module ( plugins , cmd ) plugin_class = getattr ( plugin , plugin . PLUGIN_CLASS ) return plugin_class ( settings , config ) . main ( argv ) # Print help information if no commands match. return main ( [ "--help" ] )