(tokens []string)
| 190 | } |
| 191 | |
| 192 | func extractGrepPaths(tokens []string) []string { |
| 193 | paths := []string{} |
| 194 | patternFound := false |
| 195 | skipNext := false |
| 196 | |
| 197 | for _, t := range tokens { |
| 198 | if skipNext { |
| 199 | skipNext = false |
| 200 | continue |
| 201 | } |
| 202 | |
| 203 | if t == "--" { |
| 204 | continue |
| 205 | } |
| 206 | |
| 207 | if t == "-e" || t == "-f" || t == "--regexp" || t == "--file" { |
| 208 | if !patternFound { |
| 209 | patternFound = true |
| 210 | } |
| 211 | skipNext = true |
| 212 | continue |
| 213 | } |
| 214 | |
| 215 | if strings.HasPrefix(t, "-") { |
| 216 | continue |
| 217 | } |
| 218 | |
| 219 | if !patternFound { |
| 220 | patternFound = true |
| 221 | continue |
| 222 | } |
| 223 | |
| 224 | paths = append(paths, t) |
| 225 | } |
| 226 | |
| 227 | return paths |
| 228 | } |
| 229 | |
| 230 | func extractChownPaths(tokens []string) []string { |
| 231 | ownerFound := false |