gapi: Add a new Names API
This gets the list more directly. We could also just lookup a key in the big map to get the same effect, but this is more logical for now. This is useful for removing the importing of three packages.
This commit is contained in:
@@ -41,6 +41,15 @@ func Register(name string, fn func() GAPI) {
|
||||
RegisteredGAPIs[name] = fn
|
||||
}
|
||||
|
||||
// Names returns a list of the names of all registered GAPIs.
|
||||
func Names() []string {
|
||||
names := []string{}
|
||||
for name := range RegisteredGAPIs {
|
||||
names = append(names, name)
|
||||
}
|
||||
return names
|
||||
}
|
||||
|
||||
// Flags is some common data that comes from a higher-level command, and is used
|
||||
// by a subcommand. By type circularity, the subcommands can't easily access the
|
||||
// data in the parent command struct, so instead, the data that the parent wants
|
||||
|
||||
Reference in New Issue
Block a user