Skip to content

Commit

Permalink
Refactor nodes cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
ohdearaugustin committed Jul 25, 2021
1 parent 53185ea commit 2862c20
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cmd/headscale/cli/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@ import (
"github.com/spf13/cobra"
)

var NodeCmd = &cobra.Command{
func init () {
nodeCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace")
nodeCmd.MarkPersistentFlagRequired("namespace")
nodeCmd.AddCommand(listNodesCmd)
nodeCmd.AddCommand(registerNodeCmd)
nodeCmd.AddCommand(deleteNodeCmd)
}

var nodeCmd = &cobra.Command{
Use: "nodes",
Short: "Manage the nodes of Headscale",
}

var RegisterCmd = &cobra.Command{
var registerNodeCmd = &cobra.Command{
Use: "register machineID",
Short: "Registers a machine to your network",
Args: func(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -49,7 +57,7 @@ var RegisterCmd = &cobra.Command{
},
}

var ListNodesCmd = &cobra.Command{
var listNodesCmd = &cobra.Command{
Use: "list",
Short: "List the nodes in a given namespace",
Run: func(cmd *cobra.Command, args []string) {
Expand Down Expand Up @@ -89,7 +97,7 @@ var ListNodesCmd = &cobra.Command{
},
}

var DeleteCmd = &cobra.Command{
var deleteNodeCmd = &cobra.Command{
Use: "delete ID",
Short: "Delete a node",
Args: func(cmd *cobra.Command, args []string) error {
Expand Down

0 comments on commit 2862c20

Please sign in to comment.