getNaiveFlags string-matches argv and parses them into a map. This is used when calling hooks after a plugin command, since in this case we can't rely on the cobra command tree to parse flags in this case. In this case, no values are ever passed, since we don't have enough information to process the
(args []string)
| 223 | // flags in this case. In this case, no values are ever passed, |
| 224 | // since we don't have enough information to process them. |
| 225 | func getNaiveFlags(args []string) map[string]string { |
| 226 | flags := make(map[string]string) |
| 227 | for _, arg := range args { |
| 228 | if strings.HasPrefix(arg, "--") { |
| 229 | flags[arg[2:]] = "" |
| 230 | continue |
| 231 | } |
| 232 | if strings.HasPrefix(arg, "-") { |
| 233 | flags[arg[1:]] = "" |
| 234 | } |
| 235 | } |
| 236 | return flags |
| 237 | } |
no outgoing calls
searching dependent graphs…