Cli pkg refactor (2) (#200)

This commit is contained in:
Igor Gov
2021-08-11 09:56:03 +03:00
committed by GitHub
parent 56dc6843e0
commit 7b73004e85
29 changed files with 311 additions and 283 deletions

View File

@@ -3,9 +3,7 @@ package errormessage
import (
"errors"
"fmt"
"github.com/up9inc/mizu/cli/mizu"
"github.com/up9inc/mizu/cli/config"
regexpsyntax "regexp/syntax"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
@@ -20,9 +18,9 @@ func FormatError(err error) error {
"supply the required permission or control Mizu's access to namespaces by setting %s "+
"in the config file or setting the tapped namespace with --%s %s=<NAMEPSACE>",
err,
mizu.MizuResourcesNamespaceConfigName,
mizu.SetCommandName,
mizu.MizuResourcesNamespaceConfigName)
config.MizuResourcesNamespaceConfigName,
config.SetCommandName,
config.MizuResourcesNamespaceConfigName)
} else if syntaxError, isSyntaxError := asRegexSyntaxError(err); isSyntaxError {
errorNew = fmt.Errorf("regex %s is invalid: %w", syntaxError.Expr, err)
} else {