mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-26 17:03:06 +00:00
Refactor nodes cmd
This commit is contained in:
parent
53185eaa9e
commit
2862c2034b
1 changed files with 12 additions and 4 deletions
|
@ -11,12 +11,20 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"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",
|
Use: "nodes",
|
||||||
Short: "Manage the nodes of Headscale",
|
Short: "Manage the nodes of Headscale",
|
||||||
}
|
}
|
||||||
|
|
||||||
var RegisterCmd = &cobra.Command{
|
var registerNodeCmd = &cobra.Command{
|
||||||
Use: "register machineID",
|
Use: "register machineID",
|
||||||
Short: "Registers a machine to your network",
|
Short: "Registers a machine to your network",
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
|
@ -49,7 +57,7 @@ var RegisterCmd = &cobra.Command{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var ListNodesCmd = &cobra.Command{
|
var listNodesCmd = &cobra.Command{
|
||||||
Use: "list",
|
Use: "list",
|
||||||
Short: "List the nodes in a given namespace",
|
Short: "List the nodes in a given namespace",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
@ -89,7 +97,7 @@ var ListNodesCmd = &cobra.Command{
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var DeleteCmd = &cobra.Command{
|
var deleteNodeCmd = &cobra.Command{
|
||||||
Use: "delete ID",
|
Use: "delete ID",
|
||||||
Short: "Delete a node",
|
Short: "Delete a node",
|
||||||
Args: func(cmd *cobra.Command, args []string) error {
|
Args: func(cmd *cobra.Command, args []string) error {
|
||||||
|
|
Loading…
Reference in a new issue