sip/cmd/token.go
John Olheiser 5ecbcde518
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Change to vanity URL (#37)
Fix YAML

New changes, generate docs, and add Drone for main

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

Merge branch 'master' of gitea.com:jolheiser/sip into vanity

Change to vanity URL

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

Co-authored-by: jolheiser <john.olheiser@gmail.com>
Reviewed-on: #37
2020-09-21 19:21:07 +00:00

31 lines
633 B
Go

package cmd
import (
"go.jolheiser.com/sip/config"
"github.com/urfave/cli/v2"
"go.jolheiser.com/beaver"
"go.jolheiser.com/beaver/color"
)
var Tokens = cli.Command{
Name: "tokens",
Aliases: []string{"token"},
Usage: "Manage access tokens",
Action: doTokenList,
Subcommands: []*cli.Command{
&TokensAdd,
&TokensRemove,
},
}
func doTokenList(_ *cli.Context) error {
if len(config.Tokens) == 0 {
beaver.Errorf("No tokens found! Add one with %s", 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
}