Share invocation flag lookup across installation contexts
This commit is contained in:
10
registry.go
10
registry.go
@@ -428,13 +428,11 @@ func featureSpellings(flag commandmeta.Flag) []capturedFlagSpelling {
|
||||
}
|
||||
|
||||
func validateInvocationFlagCollisions(roots map[string]*canonicalNode, flags []commandmeta.Flag) error {
|
||||
shared := invocationFlagSpellings(flags)
|
||||
for _, node := range indexCanonicalNodes(roots) {
|
||||
local := canonicalFlagSpellings(node.command)
|
||||
for _, flag := range flags {
|
||||
for _, spelling := range featureSpellings(flag) {
|
||||
if _, exists := local[flagSpellingKey(spelling)]; exists {
|
||||
return fmt.Errorf("invocation feature flag %s conflicts with command %q", spelling.token(), node.path.String())
|
||||
}
|
||||
for key, spelling := range canonicalFlagSpellings(node.command) {
|
||||
if _, exists := shared[key]; exists {
|
||||
return fmt.Errorf("invocation feature flag %s conflicts with command %q", spelling.token(), node.path.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user