parse the tag (file/dir/all), set the option accordingly, and return the trimmed string we don't worry about errors here because it will error anyway as an invalid key
(s string)
| 94 | // |
| 95 | // we don't worry about errors here because it will error anyway as an invalid key |
| 96 | func (t *transform) parseTag(s string) string { |
| 97 | if strings.HasPrefix(s, "file,") { |
| 98 | t.tag = file |
| 99 | return strings.TrimPrefix(s, "file,") |
| 100 | } |
| 101 | if strings.HasPrefix(s, "dir,") { |
| 102 | t.tag = dir |
| 103 | return strings.TrimPrefix(s, "dir,") |
| 104 | } |
| 105 | if strings.HasPrefix(s, "all,") { |
| 106 | t.tag = all |
| 107 | return strings.TrimPrefix(s, "all,") |
| 108 | } |
| 109 | return s |
| 110 | } |
| 111 | |
| 112 | // parse key and value (if any) by splitting on '=' sign |
| 113 | // (file/dir/all tag has already been trimmed) |