Add standalone command to root
This commit is contained in:
parent
425590cc9a
commit
460bb69f38
2 changed files with 36 additions and 31 deletions
|
@ -17,6 +17,7 @@ func RootCmd() *cobra.Command {
|
||||||
AddCmd(),
|
AddCmd(),
|
||||||
FilterCmd(),
|
FilterCmd(),
|
||||||
InitCmd(),
|
InitCmd(),
|
||||||
|
StandaloneCmd(),
|
||||||
TokenCmd(),
|
TokenCmd(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,37 +1,41 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
func StandaloneCmd() *cobra.Command {
|
func StandaloneCmd() *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "standalone",
|
Use: "standalone",
|
||||||
Short: "Standalone fire-and-forget commands",
|
Short: "Standalone fire-and-forget commands",
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.AddCommand(
|
cmd.AddCommand(
|
||||||
CreateJiraTicketStandaloneCmd(),
|
CreateJiraTicketStandaloneCmd(),
|
||||||
)
|
)
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateJiraTicketStandaloneCmd() *cobra.Command{
|
func CreateJiraTicketStandaloneCmd() *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "create-jira-ticket",
|
Use: "create-jira-ticket",
|
||||||
Short: "Creates a jira ticket from a template",
|
Short: "Creates a jira ticket from a template",
|
||||||
Args: cobra.NoArgs,
|
Args: cobra.NoArgs,
|
||||||
Run: createJiraTicketStandaloneCmdF,
|
Run: createJiraTicketStandaloneCmdF,
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.Flags().StringP("username", "u", "", "the jira username")
|
cmd.Flags().StringP("username", "u", "", "the jira username")
|
||||||
_ = cmd.MarkFlagRequired("username")
|
_ = cmd.MarkFlagRequired("username")
|
||||||
cmd.Flags().StringP("token", "t", "", "the jira token")
|
cmd.Flags().StringP("token", "t", "", "the jira token")
|
||||||
_ = cmd.MarkFlagRequired("token")
|
_ = cmd.MarkFlagRequired("token")
|
||||||
cmd.Flags().StringP("summary", "s", "", "the summary of the ticket")
|
cmd.Flags().StringP("summary", "s", "", "the summary of the ticket")
|
||||||
_ = cmd.MarkFlagRequired("summary")
|
_ = cmd.MarkFlagRequired("summary")
|
||||||
cmd.Flags().StringP("template", "m", "", "the template to render the description of the ticket")
|
cmd.Flags().StringP("template", "m", "", "the template to render the description of the ticket")
|
||||||
_ = cmd.MarkFlagRequired("template")
|
_ = cmd.MarkFlagRequired("template")
|
||||||
cmd.Flags().StringSliceP("vars", "v", "", "the variables to use in the template")
|
cmd.Flags().StringSliceP("vars", "v", []string{}, "the variables to use in the template")
|
||||||
|
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func createJiraTicketStandaloneCmdF(cmd *cobra.Command, _ []string) {
|
func createJiraTicketStandaloneCmdF(cmd *cobra.Command, _ []string) {
|
||||||
|
|
Loading…
Reference in a new issue