From 6334dbfacac49ec7fa8357ca1d1e55c89fe999a2 Mon Sep 17 00:00:00 2001 From: Miguel de la Cruz Date: Wed, 4 Mar 2020 22:22:16 +0100 Subject: [PATCH] Add publish command structure --- cmd/add.go | 8 ++++---- cmd/publish.go | 29 +++++++++++++++++++++++++++++ cmd/root.go | 1 + 3 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 cmd/publish.go diff --git a/cmd/add.go b/cmd/add.go index 0a3e8ce..4270109 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -16,7 +16,7 @@ import ( func GrepAddCmd() *cobra.Command { cmd := &cobra.Command{ Use: "grep", - Short: "generates the tickets reading grep's output from stdin", + Short: "Generates the tickets reading grep's output from stdin", Long: "Generates tickets for the campaign reading from the standard input the output grep. The grep command must be run with the -n flag", Example: ` grep -nriIF --include \*.go cobra.Command | campaigner add grep`, Args: cobra.NoArgs, @@ -31,7 +31,7 @@ func GrepAddCmd() *cobra.Command { func AgAddCmd() *cobra.Command { cmd := &cobra.Command{ Use: "ag", - Short: "generates the tickets reading ag's output from stdin", + Short: "Generates the tickets reading ag's output from stdin", Long: "Generates tickets for the campaign reading from the standard input the output ag", Example: ` ag cobra.Command | campaigner add ag`, Args: cobra.NoArgs, @@ -46,7 +46,7 @@ func AgAddCmd() *cobra.Command { func GovetAddCmd() *cobra.Command { cmd := &cobra.Command{ Use: "govet", - Short: "generates the tickets reading govet's output from stdin", + Short: "Generates the tickets reading govet's output from stdin", Long: "Generates tickets for the campaign reading from the standard input the output grep. The grep command must be run with the -json flag", Example: ` govet -json ./... | campaigner add govet`, Args: cobra.NoArgs, @@ -61,7 +61,7 @@ func GovetAddCmd() *cobra.Command { func CsvAddCmd() *cobra.Command { cmd := &cobra.Command{ Use: "csv", - Short: "generates the tickets reading a csv file", + Short: "Generates the tickets reading a csv file", Example: ` campaigner add csv --file tickets.csv`, Args: cobra.NoArgs, RunE: csvAddCmdF, diff --git a/cmd/publish.go b/cmd/publish.go new file mode 100644 index 0000000..d37ef4b --- /dev/null +++ b/cmd/publish.go @@ -0,0 +1,29 @@ +package cmd + +import ( + "github.com/spf13/cobra" +) + +func JiraPublishCmd() *cobra.Command { + return &cobra.Command{ + Use: "jira", + Short: "Publishes the campaign tickets in JIRA", + Args: cobra.NoArgs, + Run: jiraPublishCmdF, + } +} + +func PublishCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: "publish", + Short: "Publishes the campaign tickets in different providers", + } + + cmd.AddCommand( + JiraPublishCmd(), + ) + + return cmd +} + +func jiraPublishCmdF(_ *cobra.Command, _ []string) {} diff --git a/cmd/root.go b/cmd/root.go index 5d52207..597eb50 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -19,6 +19,7 @@ func RootCmd() *cobra.Command { InitCmd(), StandaloneCmd(), TokenCmd(), + PublishCmd(), ) return cmd