Adds the token structure

This commit is contained in:
Miguel de la Cruz 2020-02-29 00:02:56 +01:00
parent c291c97cb2
commit ae13697461
2 changed files with 58 additions and 4 deletions

View file

@ -7,13 +7,21 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
var RootCmd = &cobra.Command{ func RootCmd() *cobra.Command {
Use: "campaigner", cmd := &cobra.Command{
Short: "Create and manage Open Source campaigns", Use: "campaigner",
Short: "Create and manage Open Source campaigns",
}
cmd.AddCommand(
TokenCmd(),
)
return cmd
} }
func Execute() { func Execute() {
if err := RootCmd.Execute(); err != nil { if err := RootCmd().Execute(); err != nil {
fmt.Fprintln(os.Stderr, err) fmt.Fprintln(os.Stderr, err)
} }
} }

46
cmd/token.go Normal file
View file

@ -0,0 +1,46 @@
package cmd
import (
"github.com/spf13/cobra"
)
func TokenSetJiraCmd() *cobra.Command {
return &cobra.Command{
Use: "jira",
Short: "Sets the value of the jira token",
}
}
func TokenSetGithubCmd() *cobra.Command {
return &cobra.Command{
Use: "github",
Short: "Sets the value of the github token",
}
}
func TokenSetCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "set",
Short: "Sets the value of the platform tokens",
}
cmd.AddCommand(
TokenSetJiraCmd(),
TokenSetGithubCmd(),
)
return cmd
}
func TokenCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "token",
Short: "Subcommands related to tokens",
}
cmd.AddCommand(
TokenSetCmd(),
)
return cmd
}