fix: del goc flags, still remain some
This commit is contained in:
parent
2774123526
commit
b3e9d7dd78
@ -18,7 +18,7 @@ var serverCmd = &cobra.Command{
|
||||
func init() {
|
||||
// serverCmd.Flags().IntVarP(&config.GocConfig.Port, "port", "", 7777, "listen port to start a coverage host center")
|
||||
// serverCmd.Flags().StringVarP(&config.GocConfig.StorePath, "storepath", "", "goc.store", "the file to save all goc server information")
|
||||
serverCmd.Flags().StringVarP(&config.GocConfig.Host, "host", "", "0.0.0.0:7777", "specify the host of the goc server")
|
||||
serverCmd.Flags().StringVarP(&config.GocConfig.Host, "host", "", "127.0.0.1:7777", "specify the host of the goc server")
|
||||
rootCmd.AddCommand(serverCmd)
|
||||
}
|
||||
|
||||
|
@ -85,11 +85,17 @@ func BuildCmdArgsParse(cmd *cobra.Command, args []string) []string {
|
||||
func findAndDelGocFlag(a []string, x string) []string {
|
||||
new := make([]string, 0, len(a))
|
||||
x = "--" + x
|
||||
for _, v := range a {
|
||||
if v == x {
|
||||
for i := 0; i < len(a); i++ {
|
||||
if a[i] == "--debug" {
|
||||
// debug 是 bool,就一个元素
|
||||
continue
|
||||
} else if a[i] == x {
|
||||
// 其他 goc flag 都是两个元素
|
||||
i++
|
||||
continue
|
||||
} else {
|
||||
new = append(new, v)
|
||||
// 剩下的是 go flag
|
||||
new = append(new, a[i])
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user