Documentation
¶
Overview ¶
Package cliutil holds the flags and helpers that several subcommands share: the settings file, the cluster choice, and the schema files.
Index ¶
- Constants
- func ClientSettings(cmd *cli.Command) (*config.Settings, error)
- func ConnFlags() []cli.Flag
- func Dial(c config.NATS) (*nats.Conn, error)
- func LoadSettings(cmd *cli.Command, opts ...config.LoadOption) (*config.Settings, error)
- func ResolveCluster(cmd *cli.Command, settings *config.Settings) (config.NATS, error)
- func RootFlags() []cli.Flag
- func SchemaFlags() []cli.Flag
- type Schemas
Constants ¶
const ConfigFlag = "config"
ConfigFlag is the global --config flag. The root command declares it; every subcommand reads it through LoadSettings.
const OpsConfigFlag = "ops-config"
OpsConfigFlag is the global --ops-config flag: the YAML file of the operations commands (NATS contexts, protection rules, bot schedules).
Variables ¶
This section is empty.
Functions ¶
func ClientSettings ¶
ClientSettings loads the settings for a client command: quietly, and without requiring a cluster, since --server can replace it.
func ConnFlags ¶
ConnFlags select the NATS server a client command talks to: a cluster from the settings file, or a server given on the command line.
func Dial ¶
Dial connects to c and fails fast when the server cannot be reached: an interactive command must not wait silently for a server that is not there. After the first connect it reconnects without limit.
func LoadSettings ¶
LoadSettings loads the settings file that --config names. A file the operator named explicitly must exist.
func ResolveCluster ¶
ResolveCluster returns the connection settings the flags select.
func SchemaFlags ¶
SchemaFlags add schema files and the type header to a command.
Types ¶
type Schemas ¶
Schemas is the loaded schema state of a command.
func LoadSchemas ¶
func LoadSchemas(ctx context.Context, cmd *cli.Command, settings *config.Settings) (*Schemas, error)
LoadSchemas merges the settings' [schemas] with every --schemas file, in order, and loads the sources.