@@ -115,13 +115,12 @@ func helpMonadic(help Help, args []goal.V) goal.V {
115
115
panic (`Developer Error: Help dictionary should have a "goal" entry.` )
116
116
}
117
117
for binding , helpString := range goalHelpMap {
118
- if ( regex .MatchString (binding ) || regex .MatchString (helpString )) && ! isGeneralHelpEntry ( binding ) {
118
+ if ! isGeneralHelpEntry ( binding ) && ( regex .MatchString (binding ) || regex .MatchString (helpString )) {
119
119
fmt .Fprintln (os .Stdout , strings .TrimSpace (help .Func (binding )))
120
120
}
121
121
}
122
- // TODO Search by regular expression
123
122
default :
124
- return goal .Panicf ("help x : x not a string (%s) " , x .Type ())
123
+ return goal .Panicf ("help x : x must be a string or regex, received a %q: %v " , x .Type (), x )
125
124
}
126
125
return goal .NewI (1 )
127
126
}
@@ -141,14 +140,11 @@ func helpDyadic(help Help, args []goal.V) goal.V {
141
140
return goal .NewI (1 )
142
141
}
143
142
144
- // These are Goal's help entries that cover topic areas. We do not want to match on these for regex help matching,
145
- // as it makes the output too noisy.
146
- var generalHelpEntries = []string {
147
- "s" , "t" , "v" , "nv" , "a" , "tm" , "rt" , "io" ,
148
- }
149
-
143
+ // We do not want to match on these help topics for regex help matching, as it makes the output too noisy.
150
144
func isGeneralHelpEntry (entry string ) bool {
151
- return slices .Contains (generalHelpEntries , entry )
145
+ return slices .Contains ([]string {
146
+ "s" , "t" , "v" , "nv" , "a" , "tm" , "rt" , "io" ,
147
+ }, entry )
152
148
}
153
149
154
150
// Go <> Goal helpers
0 commit comments