23 lines
538 B
Go
23 lines
538 B
Go
package cmdutil
|
||
|
||
import "errors"
|
||
|
||
// Global flags shared across all commands.
|
||
var (
|
||
Owner string
|
||
Repo string
|
||
Format string
|
||
Debug bool
|
||
)
|
||
|
||
// ErrSilent 是 sentinel error:表示错误已经被上层处理过(如已按 envelope 格式
|
||
// 输出到 stdout),调用方(cmd.Execute)只需返回非零退出码,不要再把消息
|
||
// 打印到 stderr。
|
||
//
|
||
// 使用方式:
|
||
//
|
||
// if TryPrintError(err, format) {
|
||
// return cmdutil.ErrSilent
|
||
// }
|
||
var ErrSilent = errors.New("silent error: already reported via envelope")
|