INNER CODE UNIT · Go

init

Netis/cloud-probe · cpctl/cmd/base.go:113

func init() {
	pf := rootCmd.PersistentFlags()
	pf.StringVarP(&Globals.Unix, "unix", "u", "",
		"path to cpworker unix control socket, e.g. /var/run/cloud-probe/cpworker.sock")
	pf.StringVarP(&Globals.Format, "format", "f", FormatText,
		"output format: text|jsonl (ndjson accepted as alias for jsonl)")
	pf.DurationVarP(&Globals.Timeout, "timeout", "W", 3*time.Second,
		"per-RPC timeout")
}

// requireUnix returns an error if --unix was not set. Used by
// commands that must talk to a cpworker.
func requireUnix() error {
	if Globals.Unix == "" {
		return fmt.Errorf("--unix/-u is required (e.g. /var/run/cloud-probe/cpworker.sock)")
	}
	return nil
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…