diff --git a/cmd/root.go b/cmd/root.go index f5bdc88..5906027 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -7,13 +7,21 @@ import ( "github.com/spf13/cobra" ) -var RootCmd = &cobra.Command{ - Use: "campaigner", - Short: "Create and manage Open Source campaigns", +func RootCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "campaigner", + Short: "Create and manage Open Source campaigns", + } + + cmd.AddCommand( + TokenCmd(), + ) + + return cmd } func Execute() { - if err := RootCmd.Execute(); err != nil { + if err := RootCmd().Execute(); err != nil { fmt.Fprintln(os.Stderr, err) } } diff --git a/cmd/token.go b/cmd/token.go new file mode 100644 index 0000000..4df1055 --- /dev/null +++ b/cmd/token.go @@ -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 +}