var namespaceExample … var errNoContext … type NamespaceOptions … // NewNamespaceOptions provides an instance of NamespaceOptions with default values func NewNamespaceOptions(streams genericiooptions.IOStreams) *NamespaceOptions { … } // NewCmdNamespace provides a cobra command wrapping NamespaceOptions func NewCmdNamespace(streams genericiooptions.IOStreams) *cobra.Command { … } // Complete sets all information required for updating the current context func (o *NamespaceOptions) Complete(cmd *cobra.Command, args []string) error { … } func generateContextName(fromContext *api.Context) string { … } // Validate ensures that all required arguments and flag values are provided func (o *NamespaceOptions) Validate() error { … } // Run lists all available namespaces on a user's KUBECONFIG or updates the // current context based on a provided namespace. func (o *NamespaceOptions) Run() error { … } func isContextEqual(ctxA, ctxB *api.Context) bool { … } // setNamespace receives a "desired" context state and determines if a similar context // is already present in a user's KUBECONFIG. If one is not, then a new context is added // to the user's config under the provided destination name. // The current context field is updated to point to the new context. func (o *NamespaceOptions) setNamespace(fromContext *api.Context, withContextName string) error { … }