Go with interfaces + private opaque types

rather than public types that wrap slices
This commit is contained in:
Dan Buch
2016-05-25 12:05:14 -04:00
parent cd1e8c3452
commit 3d75e9e711
11 changed files with 187 additions and 141 deletions

View File

@@ -120,7 +120,7 @@ func (c *Command) Run(ctx *Context) (err error) {
if afterErr != nil {
HandleExitCoder(err)
if err != nil {
err = NewMultiError(err, afterErr)
err = newMultiError(err, afterErr)
} else {
err = afterErr
}
@@ -193,12 +193,12 @@ func (c *Command) startApp(ctx *Context) error {
app.Compiled = ctx.App.Compiled
app.Writer = ctx.App.Writer
app.categories = NewCommandCategories()
app.Categories = newCommandCategories()
for _, command := range c.Subcommands {
app.categories.AddCommand(command.Category, command)
app.Categories.AddCommand(command.Category, command)
}
sort.Sort(app.categories)
sort.Sort(app.Categories.(*commandCategories))
// bash completion
app.EnableBashCompletion = ctx.App.EnableBashCompletion