func InvalidFlagValueMsg(ctx *cli.Context, flag, value, msg string) error {
	var format string
	if value == "" {
		format = fmt.Sprintf("missing value for flag '--%s'", flag)
	} else {
		format = fmt.Sprintf("invalid value '%s' for flag '--%s'", value, flag)
	}
	if msg == "" {
		return errors.New(format)
	}
	return errors.New(format + "; " + msg)
}
InvalidFlagValueMsg returns an error with the given value being missing or
invalid for the given flag. Optionally it returns an error message to aid
in debugging.
package errs
import (
	"fmt"
	"os"
	"strings"
	"github.com/pkg/errors"
	"github.com/urfave/cli"
)
func NewError(format string, args ...interface{}) error {
	return errors.Errorf(format, args...)
}
func NewExitError(err error, exitCode int) error {
	return cli.NewExitError(err, exitCode)
}
func Wrap(err error, format string, args ...interface{}) error {
	if err == nil {
		return nil
	}
	cause := errors.Cause(err)
	if cause == err {
		str := err.Error()
		if i := strings.LastIndexByte(str, ':'); i >= 0 {
			str = strings.TrimSpace(str[i:])
			return errors.Wrapf(fmt.Errorf(str), format, args...)
		}
	}
	return errors.Wrapf(cause, format, args...)
}
func InsecureCommand(ctx *cli.Context) error {
	return errors.Errorf("'%s %s' requires the '--insecure' flag", ctx.App.Name, ctx.Command.Name)
}
func EqualArguments(ctx *cli.Context, arg1, arg2 string) error {
	return errors.Errorf("positional arguments <%s> and <%s> cannot be equal in '%s'", arg1, arg2, usage(ctx))
}
func MissingArguments(ctx *cli.Context, argNames ...string) error {
	switch len(argNames) {
	case 0:
		return errors.Errorf("missing positional arguments in '%s'", usage(ctx))
	case 1:
		return errors.Errorf("missing positional argument <%s> in '%s'", argNames[0], usage(ctx))
	default:
		args := make([]string, len(argNames))
		for i, name := range argNames {
			args[i] = "<" + name + ">"
		}
		return errors.Errorf("missing positional argument %s in '%s'", strings.Join(args, " "), usage(ctx))
	}
}
func NumberOfArguments(ctx *cli.Context, required int) error {
	n := ctx.NArg()
	switch {
	case n < required:
		return TooFewArguments(ctx)
	case n > required:
		return TooManyArguments(ctx)
	default:
		return nil
	}
}
func MinMaxNumberOfArguments(ctx *cli.Context, min, max int) error {
	n := ctx.NArg()
	switch {
	case n < min:
		return TooFewArguments(ctx)
	case n > max:
		return TooManyArguments(ctx)
	default:
		return nil
	}
}
func TooFewArguments(ctx *cli.Context) error {
	return errors.Errorf("not enough positional arguments were provided in '%s'", usage(ctx))
}
func TooManyArguments(ctx *cli.Context) error {
	return errors.Errorf("too many positional arguments were provided in '%s'", usage(ctx))
}
func InsecureArgument(ctx *cli.Context, name string) error {
	return errors.Errorf("positional argument <%s> requires the '--insecure' flag", name)
}
func FlagValueInsecure(ctx *cli.Context, flag, value string) error {
	return errors.Errorf("flag '--%s %s' requires the '--insecure' flag", flag, value)
}
func InvalidFlagValue(ctx *cli.Context, flag, value, options string) error {
	var format string
	if value == "" {
		format = fmt.Sprintf("missing value for flag '--%s'", flag)
	} else {
		format = fmt.Sprintf("invalid value '%s' for flag '--%s'", value, flag)
	}
	if options == "" {
		return errors.New(format)
	}
	return errors.New(format + "; options are " + options)
}