mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-07-17 01:39:06 +00:00
Merge pull request #4097 from natasha41575/deprecateFn
deprecate fn wrap, xargs, sink, source commands
This commit is contained in:
@@ -5,6 +5,7 @@ package commands
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -47,6 +48,7 @@ Environment Variables:
|
|||||||
|
|
||||||
`,
|
`,
|
||||||
RunE: r.runE,
|
RunE: r.runE,
|
||||||
|
PreRunE: r.preRunE,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
|
FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
|
||||||
Args: cobra.MinimumNArgs(1),
|
Args: cobra.MinimumNArgs(1),
|
||||||
@@ -78,6 +80,12 @@ func WrapCommand() *cobra.Command {
|
|||||||
return GetWrapRunner().Command
|
return GetWrapRunner().Command
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *WrapRunner) preRunE(_ *cobra.Command, _ []string) error {
|
||||||
|
_, err := fmt.Fprintln(os.Stderr, `Command "wrap" is deprecated, this will no longer be available in kustomize v5.
|
||||||
|
See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.`)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func (r *WrapRunner) runE(c *cobra.Command, args []string) error {
|
func (r *WrapRunner) runE(c *cobra.Command, args []string) error {
|
||||||
if r.getEnv == nil {
|
if r.getEnv == nil {
|
||||||
r.getEnv = os.Getenv
|
r.getEnv = os.Getenv
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ $ kyaml cat pkg/ --function-config config.yaml --wrap-kind ResourceList | kyaml
|
|||||||
|
|
||||||
`,
|
`,
|
||||||
RunE: r.runE,
|
RunE: r.runE,
|
||||||
|
PreRunE: r.preRunE,
|
||||||
SilenceUsage: true,
|
SilenceUsage: true,
|
||||||
FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
|
FParseErrWhitelist: cobra.FParseErrWhitelist{UnknownFlags: true},
|
||||||
Args: cobra.MinimumNArgs(1),
|
Args: cobra.MinimumNArgs(1),
|
||||||
@@ -84,6 +85,12 @@ func XArgsCommand() *cobra.Command {
|
|||||||
return GetXArgsRunner().Command
|
return GetXArgsRunner().Command
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *XArgsRunner) preRunE(_ *cobra.Command, _ []string) error {
|
||||||
|
_, err := fmt.Fprintln(os.Stderr, `Command "xargs" is deprecated, this will no longer be available in kustomize v5.
|
||||||
|
See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.`)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func (r *XArgsRunner) runE(c *cobra.Command, _ []string) error {
|
func (r *XArgsRunner) runE(c *cobra.Command, _ []string) error {
|
||||||
if len(r.Args) == 0 {
|
if len(r.Args) == 0 {
|
||||||
r.Args = os.Args
|
r.Args = os.Args
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
package commands
|
package commands
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"sigs.k8s.io/kustomize/cmd/config/internal/generateddocs/commands"
|
"sigs.k8s.io/kustomize/cmd/config/internal/generateddocs/commands"
|
||||||
"sigs.k8s.io/kustomize/cmd/config/runner"
|
"sigs.k8s.io/kustomize/cmd/config/runner"
|
||||||
@@ -20,6 +23,7 @@ func GetSinkRunner(name string) *SinkRunner {
|
|||||||
Long: commands.SinkLong,
|
Long: commands.SinkLong,
|
||||||
Example: commands.SinkExamples,
|
Example: commands.SinkExamples,
|
||||||
RunE: r.runE,
|
RunE: r.runE,
|
||||||
|
PreRunE: r.preRunE,
|
||||||
Args: cobra.MaximumNArgs(1),
|
Args: cobra.MaximumNArgs(1),
|
||||||
}
|
}
|
||||||
runner.FixDocs(name, c)
|
runner.FixDocs(name, c)
|
||||||
@@ -36,6 +40,12 @@ type SinkRunner struct {
|
|||||||
Command *cobra.Command
|
Command *cobra.Command
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *SinkRunner) preRunE(c *cobra.Command, args []string) error {
|
||||||
|
_, err := fmt.Fprintln(os.Stderr, `Command "sink" is deprecated, this will no longer be available in kustomize v5.
|
||||||
|
See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.`)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func (r *SinkRunner) runE(c *cobra.Command, args []string) error {
|
func (r *SinkRunner) runE(c *cobra.Command, args []string) error {
|
||||||
var outputs []kio.Writer
|
var outputs []kio.Writer
|
||||||
if len(args) == 1 {
|
if len(args) == 1 {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ package commands
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"sigs.k8s.io/kustomize/cmd/config/internal/generateddocs/commands"
|
"sigs.k8s.io/kustomize/cmd/config/internal/generateddocs/commands"
|
||||||
@@ -22,6 +23,7 @@ func GetSourceRunner(name string) *SourceRunner {
|
|||||||
Long: commands.SourceLong,
|
Long: commands.SourceLong,
|
||||||
Example: commands.SourceExamples,
|
Example: commands.SourceExamples,
|
||||||
RunE: r.runE,
|
RunE: r.runE,
|
||||||
|
PreRunE: r.preRunE,
|
||||||
}
|
}
|
||||||
runner.FixDocs(name, c)
|
runner.FixDocs(name, c)
|
||||||
c.Flags().StringVar(&r.WrapKind, "wrap-kind", kio.ResourceListKind,
|
c.Flags().StringVar(&r.WrapKind, "wrap-kind", kio.ResourceListKind,
|
||||||
@@ -47,6 +49,12 @@ type SourceRunner struct {
|
|||||||
Command *cobra.Command
|
Command *cobra.Command
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *SourceRunner) preRunE(c *cobra.Command, args []string) error {
|
||||||
|
_, err := fmt.Fprintln(os.Stderr, `Command "source" is deprecated, this will no longer be available in kustomize v5.
|
||||||
|
See discussion in https://github.com/kubernetes-sigs/kustomize/issues/3953.`)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
func (r *SourceRunner) runE(c *cobra.Command, args []string) error {
|
func (r *SourceRunner) runE(c *cobra.Command, args []string) error {
|
||||||
// if there is a function-config specified, emit it
|
// if there is a function-config specified, emit it
|
||||||
var functionConfig *yaml.RNode
|
var functionConfig *yaml.RNode
|
||||||
|
|||||||
Reference in New Issue
Block a user