统一命令行中文错误输出并记录发布复核证据
This commit is contained in:
1 parent
d90ddaadbb
commit
885478a7e0
3 files changed
+16
-1
No files matched your search
@@ -64,7 +64,12 @@ func Execute() {
|
||||
}
|
||||
|
||||
func newRootCommand() *cobra.Command {
|
||||
root := &cobra.Command{Use: "scert", Short: "SSL 证书服务与运维工具,业务管理请使用 Web", SilenceUsage: true}
|
||||
root := &cobra.Command{
|
||||
Use: "scert",
|
||||
Short: "SSL 证书服务与运维工具,业务管理请使用 Web",
|
||||
SilenceUsage: true,
|
||||
SilenceErrors: true,
|
||||
}
|
||||
root.CompletionOptions.DisableDefaultCmd = true
|
||||
root.SetHelpCommand(newHelpCommand())
|
||||
root.SetHelpTemplate(helpTemplate)
|
||||
|
||||
@@ -74,6 +74,9 @@ func TestRetiredBusinessCommandsRejectBeforeAccessingData(t *testing.T) {
|
||||
if strings.Contains(output.String()+err.Error(), "test-secret-not-real") {
|
||||
t.Fatal("迁移提示泄露了旧命令中的凭据参数")
|
||||
}
|
||||
if output.Len() != 0 {
|
||||
t.Fatalf("错误应交由中文入口统一输出,不能重复打印框架提示:%s", output.String())
|
||||
}
|
||||
content, readErr := os.ReadFile(path)
|
||||
if readErr != nil || !bytes.Equal(content, original) {
|
||||
t.Fatalf("被停用命令修改了配置:%v", readErr)
|
||||
|
||||
Reference in new issue
Block a user