mirror of https://github.com/k3s-io/k3s
Merge pull request #13532 from JanetKuo/kubectl-dont-use-specific-printer
Auto commit by PR queue botpull/6/head
commit
381a723814
|
@ -67,11 +67,16 @@ $ kubectl delete pods --all`
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewCmdDelete(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
func NewCmdDelete(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||||
p := kubectl.NewHumanReadablePrinter(false, false, false, false, []string{})
|
|
||||||
validArgs := p.HandledResources()
|
|
||||||
|
|
||||||
options := &DeleteOptions{}
|
options := &DeleteOptions{}
|
||||||
|
|
||||||
|
// retrieve a list of handled resources from printer as valid args
|
||||||
|
validArgs := []string{}
|
||||||
|
p, err := f.Printer(nil, false, false, false, false, []string{})
|
||||||
|
cmdutil.CheckErr(err)
|
||||||
|
if p != nil {
|
||||||
|
validArgs = p.HandledResources()
|
||||||
|
}
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])",
|
Use: "delete ([-f FILENAME] | TYPE [(NAME | -l label | --all)])",
|
||||||
Short: "Delete resources by filenames, stdin, resources and names, or by resources and label selector.",
|
Short: "Delete resources by filenames, stdin, resources and names, or by resources and label selector.",
|
||||||
|
|
|
@ -74,10 +74,16 @@ $ kubectl get rc/web service/frontend pods/web-pod-13je7`
|
||||||
// NewCmdGet creates a command object for the generic "get" action, which
|
// NewCmdGet creates a command object for the generic "get" action, which
|
||||||
// retrieves one or more resources from a server.
|
// retrieves one or more resources from a server.
|
||||||
func NewCmdGet(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
func NewCmdGet(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||||
p := kubectl.NewHumanReadablePrinter(false, false, false, false, []string{})
|
|
||||||
validArgs := p.HandledResources()
|
|
||||||
options := &GetOptions{}
|
options := &GetOptions{}
|
||||||
|
|
||||||
|
// retrieve a list of handled resources from printer as valid args
|
||||||
|
validArgs := []string{}
|
||||||
|
p, err := f.Printer(nil, false, false, false, false, []string{})
|
||||||
|
cmdutil.CheckErr(err)
|
||||||
|
if p != nil {
|
||||||
|
validArgs = p.HandledResources()
|
||||||
|
}
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "get [(-o|--output=)json|yaml|wide|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...] (TYPE [NAME | -l label] | TYPE/NAME ...) [flags]",
|
Use: "get [(-o|--output=)json|yaml|wide|go-template=...|go-template-file=...|jsonpath=...|jsonpath-file=...] (TYPE [NAME | -l label] | TYPE/NAME ...) [flags]",
|
||||||
Short: "Display one or many resources",
|
Short: "Display one or many resources",
|
||||||
|
|
|
@ -65,6 +65,8 @@ $ kubectl label pods foo bar-`
|
||||||
|
|
||||||
func NewCmdLabel(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
func NewCmdLabel(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||||
options := &LabelOptions{}
|
options := &LabelOptions{}
|
||||||
|
|
||||||
|
// retrieve a list of handled resources from printer as valid args
|
||||||
validArgs := []string{}
|
validArgs := []string{}
|
||||||
p, err := f.Printer(nil, false, false, false, false, []string{})
|
p, err := f.Printer(nil, false, false, false, false, []string{})
|
||||||
cmdutil.CheckErr(err)
|
cmdutil.CheckErr(err)
|
||||||
|
|
Loading…
Reference in New Issue