mirror of
https://gitea.com/jolheiser/sip
synced 2024-11-26 07:33:48 +01:00
894a641ef8
Clean up docs Signed-off-by: jolheiser <john.olheiser@gmail.com> Add generated docs Signed-off-by: jolheiser <john.olheiser@gmail.com> Update go.sum Signed-off-by: jolheiser <john.olheiser@gmail.com> Fix remote parsing Signed-off-by: jolheiser <john.olheiser@gmail.com> Refactor and clean up Signed-off-by: jolheiser <john.olheiser@gmail.com> Co-authored-by: jolheiser <john.olheiser@gmail.com> Reviewed-on: https://gitea.com/jolheiser/sip/pulls/29
31 lines
636 B
Go
31 lines
636 B
Go
package cmd
|
|
|
|
import (
|
|
"gitea.com/jolheiser/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
|
|
}
|