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.
37 lines
623 B
Go
37 lines
623 B
Go
package executor
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// commandUsageFunc returns the function used to print a command's help page.
|
|
func commandUsageFunc(name, summary string, flagset *flag.FlagSet) func() {
|
|
return func() {
|
|
var builder strings.Builder
|
|
|
|
fmt.Fprintf(
|
|
&builder,
|
|
"SUMMARY:\n %s - %s\n\nUSAGE:\n enbas %s [flags]\n\nFLAGS:",
|
|
name,
|
|
summary,
|
|
name,
|
|
)
|
|
|
|
flagset.VisitAll(func(f *flag.Flag) {
|
|
fmt.Fprintf(
|
|
&builder,
|
|
"\n --%s\n %s",
|
|
f.Name,
|
|
f.Usage,
|
|
)
|
|
})
|
|
|
|
builder.WriteString("\n")
|
|
|
|
w := flag.CommandLine.Output()
|
|
|
|
fmt.Fprint(w, builder.String())
|
|
}
|
|
}
|