octoprint.cli

class octoprint.cli.HiddenOption(param_decls: Sequence[str] | None = None, show_default: bool | str | None = None, prompt: bool | str = False, confirmation_prompt: bool | str = False, prompt_required: bool = True, hide_input: bool = False, is_flag: bool | None = None, flag_value: Any | None = None, multiple: bool = False, count: bool = False, allow_from_autoenv: bool = True, type: ParamType | Any | None = None, help: str | None = None, hidden: bool = False, show_choices: bool = True, show_envvar: bool = False, **attrs: Any)

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: t.Callable[te.Concatenate[T, P], R]) t.Callable[P, R]

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, disable_color=False)

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.