cmd: Add error check for Persistent Flags

This commit is contained in:
ohdearaugustin
2021-07-25 16:26:15 +02:00
parent 04dffcc4ae
commit ea3043cdcb
3 changed files with 12 additions and 1 deletions

View File

@@ -13,7 +13,10 @@ import (
func init () {
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(registerNodeCmd)
nodeCmd.AddCommand(deleteNodeCmd)