mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-26 08:53:05 +00:00
Merge branch 'main' into disable-version-check-on-json
This commit is contained in:
commit
5f0f3705c0
1 changed files with 9 additions and 0 deletions
|
@ -129,6 +129,7 @@ var deleteNodeCmd = &cobra.Command{
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
output, _ := cmd.Flags().GetString("output")
|
||||||
h, err := getHeadscaleApp()
|
h, err := getHeadscaleApp()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error initializing: %s", err)
|
log.Fatalf("Error initializing: %s", err)
|
||||||
|
@ -153,11 +154,19 @@ var deleteNodeCmd = &cobra.Command{
|
||||||
|
|
||||||
if confirm {
|
if confirm {
|
||||||
err = h.DeleteMachine(m)
|
err = h.DeleteMachine(m)
|
||||||
|
if strings.HasPrefix(output, "json") {
|
||||||
|
JsonOutput(map[string]string{"Result": "Node deleted"}, err, output)
|
||||||
|
return
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Error deleting node: %s", err)
|
log.Fatalf("Error deleting node: %s", err)
|
||||||
}
|
}
|
||||||
fmt.Printf("Node deleted\n")
|
fmt.Printf("Node deleted\n")
|
||||||
} else {
|
} else {
|
||||||
|
if strings.HasPrefix(output, "json") {
|
||||||
|
JsonOutput(map[string]string{"Result": "Node not deleted"}, err, output)
|
||||||
|
return
|
||||||
|
}
|
||||||
fmt.Printf("Node not deleted\n")
|
fmt.Printf("Node not deleted\n")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue