Files
console/internal/registry/command.go
andrey e80e292830
All checks were successful
Go Action / goaction (pull_request) Successful in 45s
move command to folder
2026-01-05 23:23:20 +03:00

40 lines
639 B
Go

package registry
import (
"fmt"
"gitoa.ru/go-4devs/console/command"
)
//nolint:gochecknoglobals
var commands = command.Commands{}
func Find(name string) (command.Command, error) {
prov, err := commands.Find(name)
if err != nil {
return prov, fmt.Errorf("%w", err)
}
return prov, nil
}
func Commands() []string {
return commands.Names()
}
func Add(cmds ...command.Command) error {
if err := commands.Add(cmds...); err != nil {
return fmt.Errorf("add:%w", err)
}
return nil
}
func Set(cmds ...command.Command) error {
if err := commands.Set(cmds...); err != nil {
return fmt.Errorf("set:%w", err)
}
return nil
}