6
6
"github.com/fntlnz/kubectl-trace/pkg/factory"
7
7
"github.com/spf13/cobra"
8
8
"k8s.io/cli-runtime/pkg/genericclioptions"
9
- // "k8s.io/kubernetes/pkg/kubectl/util/templates"
10
9
)
11
10
12
11
var (
@@ -74,6 +73,9 @@ func NewGetCommand(factory factory.Factory, streams genericclioptions.IOStreams)
74
73
if err := o .Complete (factory , c , args ); err != nil {
75
74
return err
76
75
}
76
+ if err := o .Run (); err != nil {
77
+ return err
78
+ }
77
79
return nil
78
80
},
79
81
}
@@ -100,16 +102,29 @@ func (o *GetOptions) Validate(cmd *cobra.Command, args []string) error {
100
102
101
103
// Complete completes the setup of the command.
102
104
func (o * GetOptions ) Complete (factory factory.Factory , cmd * cobra.Command , args []string ) error {
105
+ var err error
103
106
o .namespace , o .explicitNamespace , _ = factory .ToRawKubeConfigLoader ().Namespace ()
107
+ if err != nil {
108
+ return err
109
+ }
104
110
111
+ // All namespaces, when present, overrides namespace flag
105
112
if cmd .Flag ("all-namespaces" ).Changed {
106
113
o .allNamespaces = * o .ResourceBuilderFlags .AllNamespaces
107
114
o .explicitNamespace = false
108
115
o .namespace = ""
109
116
}
117
+ // Need either a namespace, a trace ID, or all namespaces
110
118
if o .traceArg == "" && ! o .allNamespaces && ! o .explicitNamespace {
111
119
return fmt .Errorf (missingTargetErr )
112
120
}
113
121
122
+ // todo > init printers (need PrintFlags)
123
+
124
+ return nil
125
+ }
126
+
127
+ // Run executes the get command.
128
+ func (o * GetOptions ) Run () error {
114
129
return nil
115
130
}
0 commit comments