2021-08-02 01:10:41 +00:00
|
|
|
package internal
|
2021-08-01 23:57:05 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/sirupsen/logrus"
|
2022-01-18 13:13:20 +00:00
|
|
|
"github.com/urfave/cli"
|
2021-08-01 23:57:05 +00:00
|
|
|
)
|
|
|
|
|
2021-09-04 23:55:10 +00:00
|
|
|
// ShowSubcommandHelpAndError exits the program on error, logs the error to the
|
|
|
|
// terminal, and shows the help command.
|
2021-08-02 01:10:41 +00:00
|
|
|
func ShowSubcommandHelpAndError(c *cli.Context, err interface{}) {
|
2021-08-02 04:58:47 +00:00
|
|
|
if err2 := cli.ShowSubcommandHelp(c); err2 != nil {
|
|
|
|
logrus.Error(err2)
|
|
|
|
}
|
2021-08-01 23:57:05 +00:00
|
|
|
logrus.Error(err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|