module Obsctl::CLI::Main

Defined in:

obsctl/cli/main.cr

Constant Summary

COMPLETION_TIMEOUT = 2.seconds

Completion must never make the shell feel stuck.

CONFIG_ACTIONS = ["explain", "diff", "migrate"]
LOCAL_COMMANDS = [{"init", "Write a default config file"}, {"doctor", "Run setup diagnostics"}, {"config explain|diff|migrate", "Inspect or migrate the config file"}, {"watch [--topics LIST]", "Stream daemon events as newline-delimited JSON"}, {"completions bash|zsh|fish", "Print a shell completion script"}, {"server [--headless]", "Run the local daemon in the foreground"}, {"service install|start|stop|restart|status|uninstall", "Manage the systemd --user unit"}, {"tui", "Open the dashboard (the default with no command)"}, {"version", "Show the obsctl version"}]

Subcommands that never reach the command registry because they are served locally, listed here so --help covers the whole surface.

LOCAL_JSON_COMMANDS = ["validate-config", "doctor", "config", "watch"]

Commands the CLI handles itself rather than proxying to the daemon.

Class Method Summary

Class Method Detail

def self.run(argv : Array(String), service_installer : Service::ServiceInstaller | Nil = nil, stdout : IO = STDOUT, stderr : IO = STDERR, tui_runner : Proc(String, Int32) | Nil = nil) : Int32 #

Entry point. .run is only the error boundary: it resolves options, delegates to dispatch, and converts any failure into the canonical exit code plus either a JSON envelope or a human diagnostic on stderr.


[View source]
def self.write_config_warnings(config : Config::Config, io : IO = STDERR) : Nil #

[View source]