campaigner/cmd/add.go

39 lines
936 B
Go
Raw Normal View History

2020-02-29 00:59:54 +01:00
package cmd
import (
"github.com/spf13/cobra"
2020-02-29 01:20:46 +01:00
"git.ctrlz.es/mgdelacroix/campaigner/model"
2020-02-29 00:59:54 +01:00
)
func AddCmd() *cobra.Command {
2020-02-29 01:20:46 +01:00
cmd := &cobra.Command{
2020-02-29 00:59:54 +01:00
Use: "add",
Short: "Adds tickets to the campaign",
2020-02-29 01:20:46 +01:00
Args: cobra.NoArgs,
RunE: addCmdF,
2020-02-29 00:59:54 +01:00
}
2020-02-29 01:20:46 +01:00
cmd.Flags().StringP("dir", "d", "", "directory containing the source code")
_ = cmd.MarkFlagRequired("dir")
cmd.Flags().StringSliceP("grep", "g", []string{}, "runs a grep command to generate the tickets")
cmd.Flags().BoolP("case-insensitive", "i", false, "makes the search case insensitive")
// cmd.Flags().StringP("govet", "v", "", "runs a govet command to generate the tickets")
// govet bin path?
return cmd
}
func RunGrep(dir string, strs []string, caseInsensitive bool) ([]model.Ticket, error) {
// grep -nrI TEXT .
// -i as well with case insensitive
return nil, nil
2020-02-29 00:59:54 +01:00
}
2020-02-29 01:20:46 +01:00
func addCmdF(cmd *cobra.Command, _ []string) error {
// either govet or grep
2020-02-29 00:59:54 +01:00
return nil
}