Add publish command structure

This commit is contained in:
Miguel de la Cruz 2020-03-04 22:22:16 +01:00
parent 4933ed1147
commit 6334dbfaca
3 changed files with 34 additions and 4 deletions

View file

@ -16,7 +16,7 @@ import (
func GrepAddCmd() *cobra.Command { func GrepAddCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "grep", 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", 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`, Example: ` grep -nriIF --include \*.go cobra.Command | campaigner add grep`,
Args: cobra.NoArgs, Args: cobra.NoArgs,
@ -31,7 +31,7 @@ func GrepAddCmd() *cobra.Command {
func AgAddCmd() *cobra.Command { func AgAddCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "ag", 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", Long: "Generates tickets for the campaign reading from the standard input the output ag",
Example: ` ag cobra.Command | campaigner add ag`, Example: ` ag cobra.Command | campaigner add ag`,
Args: cobra.NoArgs, Args: cobra.NoArgs,
@ -46,7 +46,7 @@ func AgAddCmd() *cobra.Command {
func GovetAddCmd() *cobra.Command { func GovetAddCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "govet", 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", 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`, Example: ` govet -json ./... | campaigner add govet`,
Args: cobra.NoArgs, Args: cobra.NoArgs,
@ -61,7 +61,7 @@ func GovetAddCmd() *cobra.Command {
func CsvAddCmd() *cobra.Command { func CsvAddCmd() *cobra.Command {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "csv", 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`, Example: ` campaigner add csv --file tickets.csv`,
Args: cobra.NoArgs, Args: cobra.NoArgs,
RunE: csvAddCmdF, RunE: csvAddCmdF,

29
cmd/publish.go Normal file
View file

@ -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) {}

View file

@ -19,6 +19,7 @@ func RootCmd() *cobra.Command {
InitCmd(), InitCmd(),
StandaloneCmd(), StandaloneCmd(),
TokenCmd(), TokenCmd(),
PublishCmd(),
) )
return cmd return cmd