Files
gotify-cli/cli.go
2019-04-23 17:45:51 +08:00

45 lines
864 B
Go

package main
import (
"fmt"
"os"
"github.com/gotify/cli/v2/command"
"github.com/gotify/cli/v2/utils"
"gopkg.in/urfave/cli.v1"
)
var (
// Version the version of Gotify-CLI.
Version = "unknown"
// Commit the git commit hash of this version.
Commit = "unknown"
// BuildDate the date on which this binary was build.
BuildDate = "unknown"
)
func main() {
cli.VersionPrinter = versionPrinter
app := cli.NewApp()
app.Name = "Gotify"
app.Version = Version
app.Usage = "The official Gotify-CLI"
app.Commands = []cli.Command{
command.Init(),
command.Version(),
command.Config(),
command.Push(),
command.Watch(),
}
err := app.Run(os.Args)
if err != nil {
utils.Exit1With(err)
}
}
func versionPrinter(ctx *cli.Context) {
fmt.Println("Version: " + Version)
fmt.Println("Commit: " + Commit)
fmt.Println("BuildDate: " + BuildDate)
}