forked from toolshed/abra
.chglog
autocomplete
cli
app
formatter
internal
recipe
server
cli.go
upgrade.go
version.go
cmd
pkg
scripts
tests
.drone.yml
.envrc.sample
.gitignore
.goreleaser.yml
Makefile
README.md
go.mod
go.sum
77 lines
1.8 KiB
Go
77 lines
1.8 KiB
Go
// Package cli provides the interface for the command-line.
|
|
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"coopcloud.tech/abra/cli/app"
|
|
"coopcloud.tech/abra/cli/recipe"
|
|
"coopcloud.tech/abra/cli/server"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
// Verbose stores the variable from VerboseFlag.
|
|
var Verbose bool
|
|
|
|
// VerboseFlag turns on/off verbose logging down to the INFO level.
|
|
var VerboseFlag = &cli.BoolFlag{
|
|
Name: "verbose",
|
|
Aliases: []string{"V"},
|
|
Value: false,
|
|
Destination: &Verbose,
|
|
Usage: "Show INFO messages",
|
|
}
|
|
|
|
// Debug stores the variable from DebugFlag.
|
|
var Debug bool
|
|
|
|
// DebugFlag turns on/off verbose logging down to the DEBUG level.
|
|
var DebugFlag = &cli.BoolFlag{
|
|
Name: "debug",
|
|
Aliases: []string{"d"},
|
|
Value: false,
|
|
Destination: &Debug,
|
|
Usage: "Show DEBUG messages",
|
|
}
|
|
|
|
// RunApp runs CLI abra app.
|
|
func RunApp(version, commit string) {
|
|
app := &cli.App{
|
|
Name: "abra",
|
|
Usage: `The Co-op Cloud command-line utility belt 🎩🐇
|
|
|
|
____ ____ _ _
|
|
/ ___|___ ___ _ __ / ___| | ___ _ _ __| |
|
|
| | / _ \ _____ / _ \| '_ \ | | | |/ _ \| | | |/ _' |
|
|
| |__| (_) |_____| (_) | |_) | | |___| | (_) | |_| | (_| |
|
|
\____\___/ \___/| .__/ \____|_|\___/ \__,_|\__,_|
|
|
|_|
|
|
`,
|
|
Version: fmt.Sprintf("%s-%s", version, commit[:7]),
|
|
Commands: []*cli.Command{
|
|
app.AppCommand,
|
|
server.ServerCommand,
|
|
recipe.RecipeCommand,
|
|
VersionCommand,
|
|
UpgradeCommand,
|
|
},
|
|
Flags: []cli.Flag{
|
|
VerboseFlag,
|
|
DebugFlag,
|
|
},
|
|
Authors: []*cli.Author{
|
|
&cli.Author{
|
|
Name: "Autonomic Co-op",
|
|
Email: "helo@autonomic.zone",
|
|
},
|
|
},
|
|
}
|
|
app.EnableBashCompletion = true
|
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
}
|