Cleanup: Todos in cmd/
This commit is contained in:
parent
c79b8ed1ae
commit
cc8399ba63
@ -91,7 +91,7 @@ func parseGetClusterCmd(cmd *cobra.Command, args []string) (*k3d.Cluster, bool)
|
||||
return nil, headersOff
|
||||
}
|
||||
|
||||
cluster := &k3d.Cluster{Name: args[0]} // TODO: validate name first?
|
||||
cluster := &k3d.Cluster{Name: args[0]}
|
||||
|
||||
return cluster, headersOff
|
||||
}
|
||||
@ -102,7 +102,7 @@ func printClusters(clusters []*k3d.Cluster, headersOff bool) {
|
||||
defer tabwriter.Flush()
|
||||
|
||||
if !headersOff {
|
||||
headers := []string{"NAME", "MASTERS", "WORKERS"} // TODO: add status
|
||||
headers := []string{"NAME", "MASTERS", "WORKERS"} // TODO: getCluster: add status column
|
||||
_, err := fmt.Fprintf(tabwriter, "%s\n", strings.Join(headers, "\t"))
|
||||
if err != nil {
|
||||
log.Fatalln("Failed to print headers")
|
||||
|
@ -37,7 +37,7 @@ func NewCmdGetKubeconfig() *cobra.Command {
|
||||
|
||||
// create new command
|
||||
cmd := &cobra.Command{
|
||||
Use: "kubeconfig NAME", // TODO: enable putting more than one name or even --all
|
||||
Use: "kubeconfig NAME", // TODO: getKubeconfig: allow more than one cluster name or even --all
|
||||
Short: "Get kubeconfig",
|
||||
Long: `Get kubeconfig.`,
|
||||
Args: cobra.MinimumNArgs(1),
|
||||
@ -61,7 +61,7 @@ func NewCmdGetKubeconfig() *cobra.Command {
|
||||
if err := cmd.MarkFlagFilename("output"); err != nil {
|
||||
log.Fatalln("Failed to mark flag --output as filename")
|
||||
}
|
||||
// cmd.Flags().BoolP("all", "a", false, "Get kubeconfigs from all existing clusters") // TODO:
|
||||
// cmd.Flags().BoolP("all", "a", false, "Get kubeconfigs from all existing clusters") // TODO: getKubeconfig: enable --all flag
|
||||
|
||||
// done
|
||||
return cmd
|
||||
@ -75,5 +75,5 @@ func parseGetKubeconfigCmd(cmd *cobra.Command, args []string) (*k3d.Cluster, str
|
||||
log.Fatalln("No output specified")
|
||||
}
|
||||
|
||||
return &k3d.Cluster{Name: args[0]}, output // TODO: validate first
|
||||
return &k3d.Cluster{Name: args[0]}, output
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ func NewCmdGetNode() *cobra.Command {
|
||||
|
||||
// create new command
|
||||
cmd := &cobra.Command{
|
||||
Use: "node", // TODO: set one or more names or --all flag
|
||||
Use: "node NAME", // TODO: getNode: allow one or more names or --all flag
|
||||
Short: "Get node",
|
||||
Aliases: []string{"nodes"},
|
||||
Long: `Get node.`,
|
||||
|
@ -77,7 +77,7 @@ func parseLoadImageCmd(cmd *cobra.Command, args []string) ([]string, []k3d.Clust
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
if cmd.Flags().Changed("tar") { // TODO: implement import from local tarball
|
||||
if cmd.Flags().Changed("tar") { // TODO: loadImage: implement import from local tarball
|
||||
log.Fatalf("--tar flag not supported yet '%s'", localTarball)
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ func NewCmdCompletion() *cobra.Command {
|
||||
Use: "completion SHELL",
|
||||
Short: "Generate completion scripts for [bash, zsh, powershell | psh]",
|
||||
Long: `Generate completion scripts for [bash, zsh, powershell | psh]`,
|
||||
Args: cobra.ExactArgs(1), // TODO: add support for 0 args = auto detection
|
||||
Args: cobra.ExactArgs(1), // TODO: NewCmdCompletion: add support for 0 args = auto detection
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if f, ok := completionFunctions[args[0]]; ok {
|
||||
if err := f(os.Stdout); err != nil {
|
||||
|
@ -34,7 +34,7 @@ func NewCmdStartNode() *cobra.Command {
|
||||
|
||||
// create new command
|
||||
cmd := &cobra.Command{
|
||||
Use: "node NAME", // TODO: allow one or more names or --all
|
||||
Use: "node NAME", // TODO: startNode: allow one or more names or --all
|
||||
Short: "Start an existing k3d node",
|
||||
Long: `Start an existing k3d node.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
@ -52,10 +52,10 @@ func NewCmdStartNode() *cobra.Command {
|
||||
|
||||
// parseStartNodeCmd parses the command input into variables required to start a node
|
||||
func parseStartNodeCmd(cmd *cobra.Command, args []string) *k3d.Node {
|
||||
// node name // TODO: allow node filters, e.g. `k3d start nodes mycluster@worker` to start all worker nodes of cluster 'mycluster'
|
||||
// node name // TODO: startNode: allow node filters, e.g. `k3d start nodes mycluster@worker` to start all worker nodes of cluster 'mycluster'
|
||||
if len(args) == 0 || len(args[0]) == 0 {
|
||||
log.Fatalln("No node name given")
|
||||
}
|
||||
|
||||
return &k3d.Node{Name: args[0]} // TODO: validate and allow for more than one
|
||||
return &k3d.Node{Name: args[0]}
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ func NewCmdStopNode() *cobra.Command {
|
||||
|
||||
// create new command
|
||||
cmd := &cobra.Command{
|
||||
Use: "node NAME", // TODO: allow one or more names or --all",
|
||||
Use: "node NAME", // TODO: stopNode: allow one or more names or --all",
|
||||
Short: "Stop an existing k3d node",
|
||||
Long: `Stop an existing k3d node.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
@ -58,5 +58,5 @@ func parseStopNodeCmd(cmd *cobra.Command, args []string) *k3d.Node {
|
||||
log.Fatalln("No node name given")
|
||||
}
|
||||
|
||||
return &k3d.Node{Name: args[0]} // TODO: validate and allow for more than one
|
||||
return &k3d.Node{Name: args[0]}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ func FilterNodes(nodes []*k3d.Node, filters []string) ([]*k3d.Node, error) {
|
||||
|
||||
// if one of the filters is 'all', we only return this and drop all others
|
||||
if submatches["group"] == "all" {
|
||||
// TODO: only log if really more than one is specified
|
||||
// TODO: filterNodes: only log if really more than one is specified
|
||||
log.Warnf("Node filter 'all' set, but more were specified in '%+v'", filters)
|
||||
return nodes, nil
|
||||
}
|
||||
|
@ -70,5 +70,5 @@ func ParseAPIPort(portString string) (k3d.ExposeAPI, error) {
|
||||
|
||||
// ValidatePortMap validates a port mapping
|
||||
func ValidatePortMap(portmap string) (string, error) {
|
||||
return portmap, nil // TODO: add validation of port mapping
|
||||
return portmap, nil // TODO: ValidatePortMap: add validation of port mapping
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user