gpaste/cmd/client/client.go

69 lines
1.3 KiB
Go
Raw Normal View History

2022-01-15 18:07:33 +00:00
package main
2022-01-16 20:51:04 +00:00
import (
"fmt"
"os"
2022-01-20 02:47:58 +00:00
"git.t-juice.club/torjus/gpaste/cmd/client/actions"
2022-01-16 20:51:04 +00:00
"github.com/urfave/cli/v2"
)
var (
version = "dev"
commit = "none"
date = "unknown"
)
2022-01-15 18:07:33 +00:00
func main() {
2022-01-16 20:51:04 +00:00
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.",
},
2022-01-19 21:44:00 +00:00
&cli.StringFlag{
Name: "url",
Usage: "Base url of gpaste server",
},
2022-01-16 20:51:04 +00:00
},
Commands: []*cli.Command{
{
Name: "upload",
Usage: "Upload file(s)",
ArgsUsage: "FILE [FILE]...",
2022-01-20 02:47:58 +00:00
Action: actions.ActionUpload,
2022-01-19 21:44:00 +00:00
},
2022-01-21 06:17:52 +00:00
{
Name: "delete",
Usage: "Delete file(s)",
ArgsUsage: "FILE [FILE]...",
Action: actions.ActionDelete,
},
2022-01-19 21:44:00 +00:00
{
Name: "login",
Usage: "Login to gpaste server",
ArgsUsage: "USERNAME",
2022-01-20 02:47:58 +00:00
Action: actions.ActionLogin,
2022-01-16 20:51:04 +00:00
},
2022-01-20 02:22:18 +00:00
{
Name: "admin",
Usage: "Admin related commands",
Subcommands: []*cli.Command{
{
Name: "create-user",
Usage: "Create a new user",
ArgsUsage: "USERNAME",
2022-01-20 02:47:58 +00:00
Action: actions.ActionUserCreate,
2022-01-20 02:22:18 +00:00
},
},
},
2022-01-16 20:51:04 +00:00
},
}
2022-01-24 19:25:52 +00:00
_ = app.Run(os.Args)
2022-01-16 20:51:04 +00:00
}