commoncli

package
v1.2.14-prerelease08 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitHandler

func ExitHandler(err error)

ExitHandler converts errors that urfave/cli did not handle into a nicely printed message, and an appropriate os.Exit call to ensure this func never returns from either branch.

This should be used instead of an in-CLI ExitErrHandler, as using that still leaves a dangling `err` return value from *cli.App.Run(), which is awkward in a number of ways.

func Problem

func Problem(msg string, err error) error

Problem returns a typed error that will report this message "nicely" to the user if it exits the CLI app. The message will be used as the top-level "Error: ..." string regardless of where in the error stack it is, and other wrapped errors will be printed line by line beneath it.

Nested Problem messages will nest structurally, like:

Error: msg
Details:
  some error
  some other error
  Error: message
  ErrorDetails:
    more nested errors

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL