constanze/main.go

65 lines
1.2 KiB
Go

package main
import (
log "github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
"os"
)
func main() {
app := &cli.App{
Name: "constanze",
Usage: "tinker with akkoma instances",
Commands: commands(),
Flags: []cli.Flag{
&cli.StringFlag{
Name: "config",
Value: "config.yml",
Usage: "Point to your config file",
},
&cli.BoolFlag{
Name: "debug",
Value: false,
Usage: "Enable debug logging",
},
},
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}
func commands() []*cli.Command {
return []*cli.Command{
{
Name: "configure",
Usage: "Set up costanze",
Action: Configure,
},
{
Name: "login",
Usage: "Log in to your instance",
Aliases: []string{"token"},
Action: Login,
Flags: []cli.Flag{
&cli.StringFlag{
Name: "scopes",
Value: "read write follow push",
Usage: "Scopes to request",
},
&cli.BoolFlag{
Name: "client-app",
Value: false,
Usage: "Create a new oauth app, but just print out the credentials for later use",
},
&cli.StringFlag{
Name: "client-name",
Value: "costanze",
Usage: "Name of the client app",
},
},
},
}
}