Dan Anglin
55b93c6586
Move all executors to the internal folder package. This PR also comes with additional breaking changes. Changes: - refactor: move all executors to the internal/executor package. - refactor: update naming patterns for constants, variables, custom types, etc. - fix(breaking): renamed the update command to edit. - fix(breaking): update the flags for the switch command to make it more generic. - fix(breaking): renamed the show-account-relationship flag to show-relationship. - fix: update the print message from the whoami command.
21 lines
441 B
Go
21 lines
441 B
Go
package executor
|
|
|
|
import "fmt"
|
|
|
|
type Executor interface {
|
|
Name() string
|
|
Parse(args []string) error
|
|
Execute() error
|
|
}
|
|
|
|
func Execute(executor Executor, args []string) error {
|
|
if err := executor.Parse(args); err != nil {
|
|
return fmt.Errorf("unable to parse the command line flags; %w", err)
|
|
}
|
|
|
|
if err := executor.Execute(); err != nil {
|
|
return fmt.Errorf("unable to execute the command %q; %w", executor.Name(), err)
|
|
}
|
|
|
|
return nil
|
|
}
|