INNER CODE UNIT · Go

usageError

openrundev/openrun · cmd/openrun/main.go:279

func usageError(flags []cli.Flag, helpPath string, err error) error {
	if flagName, ok := strings.CutPrefix(err.Error(), "flag provided but not defined: -"); ok && cli.SuggestFlag != nil {
		if suggestion := cli.SuggestFlag(flags, flagName, false); suggestion != "" {
			return fmt.Errorf("%w (did you mean %q?)\nrun '%s --help' for usage", err, suggestion, helpPath)
		}
	}
	return fmt.Errorf("%w\nrun '%s --help' for usage", err, helpPath)
}

func main() {
	// Start the OS service control handler if launched by the Windows
	// service control manager. Must run before any long initialization so
	// the service reports StartPending promptly.
	system.MaybeRunAsService()

	globalConfig, clientConfig, serverConfig, err := system.GetDefaultConfigs()
	if err != nil {
		fatalError(err)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…