(key string)
| 24 | return vs |
| 25 | } |
| 26 | func TargetOf(key string) *Target { |
| 27 | index := strings.Index(key, ":") |
| 28 | if index > 0 { |
| 29 | |
| 30 | tp := Parse(key[0:index]) |
| 31 | if tp != Invalid { |
| 32 | name := key[index+1:] |
| 33 | |
| 34 | if tp == Special { |
| 35 | if v, has := specialRoles[name]; has { |
| 36 | return v |
| 37 | } |
| 38 | } |
| 39 | return tp.Target(name, "unknown") |
| 40 | } |
| 41 | } |
| 42 | return &Target{ |
| 43 | Type: Invalid, |
| 44 | Name: key, |
| 45 | Label: key, |
| 46 | } |
| 47 | |
| 48 | } |
| 49 | |
| 50 | func CompleteLabels(ctx context.Context, vs ...*Target) { |
| 51 | ml := turn(vs) |