Documentation
¶
Overview ¶
Package cmd builds the sonar client CLI command tree on top of service.Service using spf13/cobra directly — no cmdx. Per-command flag / argument / validation wiring lives in this package next to the commands themselves via the closure pattern: a build func that configures the command and returns its run. Authorization (incl. admin-only commands) is enforced by the service layer, not here.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultMessengersPreExec ¶
DefaultMessengersPreExec adapts the command tree for messenger (chat) use: it renders commands in slash style (e.g. "/dns" instead of "sonar dns") and drops the auto-generated completion command, which is meaningless in chat. Pass it to New via PreExec.
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
Command builds the client command tree against a service.Service.
func (*Command) Exec ¶
Exec builds the tree, applies the PreExec hook, installs a result sink in ctx, and runs args. The result is either the typed service output from the invoked leaf or, when no leaf produced data (help/usage/completion), the raw text cobra wrote. Execution errors are returned separately.
func (*Command) ParseAndExec ¶
ParseAndExec splits s into args (stripping a leading "/", as messengers send) and runs it.
type Option ¶
type Option func(*options)
Option configures a Command.
func AllowFileAccess ¶
AllowFileAccess enables flags that read local files (e.g. http --file). For use in the CLI application only — must stay false for messengers, otherwise there is a local file read vulnerability.