Documentation
¶
Overview ¶
Package cli wires unison's command-line interface together.
unison is a sqlc codegen plugin and the orchestrator that drives it. The two modes share one binary, so this package owns the one decision that separates them and the logging setup they both use.
Logging is stdlib slog to stderr, and that is not a style preference. In plugin mode sqlc hands the process a CodeGenRequest on stdin and reads a CodeGenResponse protobuf back from stdout, so stdout is a protocol channel: anything else written there corrupts the response. Nothing in this module may print to stdout outside of a command that owns its own output.
Index ¶
Constants ¶
const CommandName = "unison"
CommandName is the name the CLI reports for itself. It is the tool's name rather than the module's, because that is what a consumer types and what .unison-version pins.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
Execute dispatches to one of unison's two modes.
Plugin mode is not a subcommand, because sqlc does not call it like one: it passes the gRPC method to invoke as the first argument, writes a request to stdin, and expects a response on stdout. Deciding here — before cobra sees the arguments — is what keeps that call from being parsed as a typo.
Types ¶
This section is empty.