From 97aaf4c0d94801b01f3d3d93f509b476351e6de6 Mon Sep 17 00:00:00 2001 From: Rick Spurgeon Date: Thu, 25 Jan 2024 01:49:53 -0600 Subject: [PATCH] chore(namespace): add cli help message (#1185) --- cmd/file_namespace.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/file_namespace.go b/cmd/file_namespace.go index 959487fbe..aabee9e9a 100644 --- a/cmd/file_namespace.go +++ b/cmd/file_namespace.go @@ -59,6 +59,10 @@ func executeNamespace(cmd *cobra.Command, _ []string) error { err = namespace.Apply(yamlNode, selectors, cmdNamespacePathPrefix, cmdNamespaceAllowEmptySelectors) if err != nil { + if strings.Contains(err.Error(), "no routes matched the selectors") { + // append CLI specific message + err = fmt.Errorf("%w (use --allow-empty-selectors to suppress this error)", err) + } return fmt.Errorf("failed to apply the namespace: %w", err) }