Wrapper for github.com/urfave/cli/v2
This stable version.
package main
import (
"os"
"github.com/mantyr/app"
"internal/commands/cli"
"internal/commands/server"
)
var (
versionInfo = "dev"
)
func main() {
app := app.New()
app.Name = "name"
app.Usage = "usage"
app.Version = versionInfo
app.Description = "description"
app.Register(
cli.New(),
server.New(),
)
app.RunAndFatal(os.Args)
}
package cli
import (
"github.com/mantyr/app"
"github.com/mantyr/app/commands"
"internal/commands/cli/item1"
"internal/commands/cli/item2"
)
type Command struct {
commands.Command
}
func New() *Command {
return &Command{}
}
func (c *Command) Init() error {
c.Command.Name = "cli"
c.Command.Usage = "Command Line Interface"
c.Command.Description = "description"
return nil
}
func (c *Command) Subcommands() []app.Command {
return []app.Command{
item1.New(),
item2.New(),
}
}