1
0
mirror of https://gitea.com/jolheiser/sip synced 2024-11-22 19:51:58 +01:00
sip/cmd/token.go
John Olheiser 427ecdb7f1 Clean up and polish (#1)
Move issues validator

Signed-off-by: jolheiser <john.olheiser@gmail.com>

Comments

Signed-off-by: jolheiser <john.olheiser@gmail.com>

Package cleanup

Signed-off-by: jolheiser <john.olheiser@gmail.com>

Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: https://gitea.com/jolheiser/sip/pulls/1
2020-02-18 05:27:52 +00:00

30 lines
662 B
Go

package cmd
import (
"gitea.com/jolheiser/beaver"
"gitea.com/jolheiser/beaver/color"
"gitea.com/jolheiser/sip/modules/config"
"github.com/urfave/cli/v2"
)
var Tokens = cli.Command{
Name: "tokens",
Aliases: []string{"token"},
Usage: "Manage access tokens",
Action: doTokenList,
Subcommands: []*cli.Command{
&TokensAdd,
&TokensRemove,
},
}
func doTokenList(ctx *cli.Context) error {
if len(config.Tokens) == 0 {
beaver.Errorf("No tokens found! Add one with %s", color.New(color.FgMagenta).Format("sip token create"))
}
for idx, token := range config.Tokens {
beaver.Infof("%d. %s (%s)", idx+1, token.Name, token.URL)
}
return nil
}