mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-24 16:58:05 +00:00
cmd: Add error check for Persistent Flags
This commit is contained in:
parent
04dffcc4ae
commit
ea3043cdcb
@ -13,7 +13,10 @@ import (
|
|||||||
|
|
||||||
func init () {
|
func init () {
|
||||||
nodeCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace")
|
nodeCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace")
|
||||||
nodeCmd.MarkPersistentFlagRequired("namespace")
|
err := nodeCmd.MarkPersistentFlagRequired("namespace")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf(err.Error())
|
||||||
|
}
|
||||||
nodeCmd.AddCommand(listNodesCmd)
|
nodeCmd.AddCommand(listNodesCmd)
|
||||||
nodeCmd.AddCommand(registerNodeCmd)
|
nodeCmd.AddCommand(registerNodeCmd)
|
||||||
nodeCmd.AddCommand(deleteNodeCmd)
|
nodeCmd.AddCommand(deleteNodeCmd)
|
||||||
|
@ -13,6 +13,10 @@ import (
|
|||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(preauthkeysCmd)
|
rootCmd.AddCommand(preauthkeysCmd)
|
||||||
preauthkeysCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace")
|
preauthkeysCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace")
|
||||||
|
err := preauthkeysCmd.MarkPersistentFlagRequired("namespace")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf(err.Error())
|
||||||
|
}
|
||||||
preauthkeysCmd.AddCommand(listPreAuthKeys)
|
preauthkeysCmd.AddCommand(listPreAuthKeys)
|
||||||
preauthkeysCmd.AddCommand(createPreAuthKeyCmd)
|
preauthkeysCmd.AddCommand(createPreAuthKeyCmd)
|
||||||
createPreAuthKeyCmd.PersistentFlags().Bool("reusable", false, "Make the preauthkey reusable")
|
createPreAuthKeyCmd.PersistentFlags().Bool("reusable", false, "Make the preauthkey reusable")
|
||||||
|
@ -11,6 +11,10 @@ import (
|
|||||||
func init() {
|
func init() {
|
||||||
rootCmd.AddCommand(routesCmd)
|
rootCmd.AddCommand(routesCmd)
|
||||||
routesCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace")
|
routesCmd.PersistentFlags().StringP("namespace", "n", "", "Namespace")
|
||||||
|
err := routesCmd.MarkPersistentFlagRequired("namespace")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf(err.Error())
|
||||||
|
}
|
||||||
routesCmd.AddCommand(listRoutesCmd)
|
routesCmd.AddCommand(listRoutesCmd)
|
||||||
routesCmd.AddCommand(enableRouteCmd)
|
routesCmd.AddCommand(enableRouteCmd)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user