octoprint.cli

class octoprint.cli.HiddenOption(param_decls=None, show_default=False, prompt=False, confirmation_prompt=False, hide_input=False, is_flag=None, flag_value=None, multiple=False, count=False, allow_from_autoenv=True, type=None, help=None, hidden=False, show_choices=True, show_envvar=False, **attrs)

Custom option sub class with empty help.

class octoprint.cli.OctoPrintContext(configfile=None, basedir=None, verbosity=0, safe_mode=False)

Custom context wrapping the standard options.

octoprint.cli.bulk_options(options)

Utility decorator to decorate a function with a list of click decorators.

The provided list of options will be reversed to ensure correct processing order (inverse from what would be intuitive).

octoprint.cli.hidden_option(*param_decls, **attrs)

Attaches a hidden option to the command. All positional arguments are passed as parameter declarations to Option; all keyword arguments are forwarded unchanged. This is equivalent to creating an Option instance manually and attaching it to the Command.params list.

octoprint.cli.init_platform_for_cli(ctx)

Performs a basic platform initialization for the CLI.

Plugin implementations will be initialized, but only with a subset of the usual property injections:

  • _identifier and everything else parsed from metadata

  • _logger

  • _connectivity_checker

  • _environment_detector

  • _event_bus

  • _plugin_manager

  • _settings

Returns: the same list of components as returned by init_platform

octoprint.cli.legacy_options(f)

Legacy options available directly on the “octoprint” command in earlier versions. Kept available for reasons of backwards compatibility, but hidden from the generated help pages.

octoprint.cli.pass_octoprint_ctx(f)

Decorator to pass in the OctoPrintContext instance.

octoprint.cli.set_ctx_obj_option(ctx, param, value)

Helper for setting eager options on the context.

octoprint.cli.standard_options(hidden=False)

Decorator to add the standard options shared among all “octoprint” commands.

If hidden is set to True, the options will be available on the command but not listed in its help page.

octoprint.cli.dev

class octoprint.cli.dev.OctoPrintDevelCommands(*args, **kwargs)

Custom click.MultiCommand implementation that provides commands relevant for (plugin) development based on availability of development dependencies.

get_command(ctx, cmd_name)

Given a context and a command name, this returns a Command object if it exists or returns None.

list_commands(ctx)

Returns a list of subcommand names in the order they should appear.

octoprint.cli.plugins

class octoprint.cli.plugins.OctoPrintPluginCommands(*args, **kwargs)

Custom click.MultiCommand implementation that collects commands from the plugin hook octoprint.cli.commands.

settings

The global Settings instance.

plugin_manager

The PluginManager instance.

get_command(ctx, cmd_name)

Given a context and a command name, this returns a Command object if it exists or returns None.

list_commands(ctx)

Returns a list of subcommand names in the order they should appear.

octoprint.cli.server

octoprint.cli.server.daemon_options(f)

Decorator to add the options for the daemon subcommand: --pid.

octoprint.cli.server.run_server(basedir, configfile, host, port, v6_only, debug, allow_root, logging_config, verbosity, safe_mode, ignore_blacklist, octoprint_daemon=None, overlays=None)

Initializes the environment and starts up the server.

octoprint.cli.server.server_options(f)

Decorator to add the options shared among the server commands: --host, --port, -4, -6 --logging, --iknowwhatimdoing and --debug.