gpaste/cmd/client/client.go
Torjus Håkestad e0850233dc
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Add actions packages for cli stuff
2022-01-20 03:47:58 +01:00

63 lines
1.1 KiB
Go

package main
import (
"fmt"
"os"
"git.t-juice.club/torjus/gpaste/cmd/client/actions"
"github.com/urfave/cli/v2"
)
var (
version = "dev"
commit = "none"
date = "unknown"
)
func main() {
cli.VersionFlag = &cli.BoolFlag{Name: "version"}
app := cli.App{
Name: "gpaste",
Version: fmt.Sprintf("gpaste %s-%s (%s)", version, commit, date),
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Usage: "Path to config-file.",
},
&cli.StringFlag{
Name: "url",
Usage: "Base url of gpaste server",
},
},
Commands: []*cli.Command{
{
Name: "upload",
Usage: "Upload file(s)",
ArgsUsage: "FILE [FILE]...",
Action: actions.ActionUpload,
},
{
Name: "login",
Usage: "Login to gpaste server",
ArgsUsage: "USERNAME",
Action: actions.ActionLogin,
},
{
Name: "admin",
Usage: "Admin related commands",
Subcommands: []*cli.Command{
{
Name: "create-user",
Usage: "Create a new user",
ArgsUsage: "USERNAME",
Action: actions.ActionUserCreate,
},
},
},
},
}
app.Run(os.Args)
}