added excludellist to CreateFlags
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package set
|
package set
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/hpcng/warewulf/internal/pkg/container"
|
"github.com/hpcng/warewulf/internal/pkg/container"
|
||||||
@@ -46,15 +45,9 @@ func init() {
|
|||||||
var emptyNodeConf node.NodeConf
|
var emptyNodeConf node.NodeConf
|
||||||
emptyNodeConf.Kernel = new(node.KernelConf)
|
emptyNodeConf.Kernel = new(node.KernelConf)
|
||||||
emptyNodeConf.Ipmi = new(node.IpmiConf)
|
emptyNodeConf.Ipmi = new(node.IpmiConf)
|
||||||
OptionStrMap = myBase.CreateFlags(emptyNodeConf, []string{})
|
OptionStrMap = myBase.CreateFlags(emptyNodeConf,
|
||||||
fmt.Println(baseCmd.Flags().Args())
|
[]string{"ipaddr", "ipaddr6", "ipmiaddr", "profile"})
|
||||||
flag := baseCmd.Flag("ipaddr")
|
|
||||||
if flag != nil {
|
|
||||||
flag.Name = "donotuse"
|
|
||||||
flag.Usage = "FooBaar"
|
|
||||||
} else {
|
|
||||||
fmt.Println("Flag not found")
|
|
||||||
}
|
|
||||||
baseCmd.PersistentFlags().StringVarP(&SetNetDevDel, "netdel", "D", "", "Delete the node's network device")
|
baseCmd.PersistentFlags().StringVarP(&SetNetDevDel, "netdel", "D", "", "Delete the node's network device")
|
||||||
baseCmd.PersistentFlags().BoolVarP(&SetNodeAll, "all", "a", false, "Set all nodes")
|
baseCmd.PersistentFlags().BoolVarP(&SetNodeAll, "all", "a", false, "Set all nodes")
|
||||||
baseCmd.PersistentFlags().BoolVarP(&SetYes, "yes", "y", false, "Set 'yes' to all questions asked")
|
baseCmd.PersistentFlags().BoolVarP(&SetYes, "yes", "y", false, "Set 'yes' to all questions asked")
|
||||||
|
|||||||
@@ -559,7 +559,7 @@ func (baseCmd *CobraCommand) CreateFlags(theStruct interface{}, excludeList []st
|
|||||||
wwlog.Warn("handling of %v not implemented\n", field.Type)
|
wwlog.Warn("handling of %v not implemented\n", field.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if field.Tag.Get("comment") != "" && !util.InSlice(excludeList, field.Name) {
|
} else if field.Tag.Get("comment") != "" && !util.InSlice(excludeList, field.Tag.Get("lopt")) {
|
||||||
var newStr string
|
var newStr string
|
||||||
optionsMap[field.Name] = &newStr
|
optionsMap[field.Name] = &newStr
|
||||||
if field.Tag.Get("sopt") != "" {
|
if field.Tag.Get("sopt") != "" {
|
||||||
@@ -568,7 +568,7 @@ func (baseCmd *CobraCommand) CreateFlags(theStruct interface{}, excludeList []st
|
|||||||
field.Tag.Get("sopt"),
|
field.Tag.Get("sopt"),
|
||||||
field.Tag.Get("default"),
|
field.Tag.Get("default"),
|
||||||
field.Tag.Get("comment"))
|
field.Tag.Get("comment"))
|
||||||
} else if !util.InSlice(excludeList, field.Name) {
|
} else if !util.InSlice(excludeList, field.Tag.Get("lopt")) {
|
||||||
baseCmd.PersistentFlags().StringVar(&newStr,
|
baseCmd.PersistentFlags().StringVar(&newStr,
|
||||||
field.Tag.Get("lopt"),
|
field.Tag.Get("lopt"),
|
||||||
field.Tag.Get("default"),
|
field.Tag.Get("default"),
|
||||||
|
|||||||
Reference in New Issue
Block a user