Add --campaign persistent flag

This commit is contained in:
Miguel de la Cruz 2020-09-24 13:34:25 +02:00
parent da89cad164
commit 7b1b61a582

View file

@ -11,7 +11,9 @@ import (
func withApp(f func(*app.App, *cobra.Command, []string)) func(*cobra.Command, []string) {
return func(cmd *cobra.Command, args []string) {
a, err := app.NewApp("./campaign.json")
campaignPath, _ := cmd.Flags().GetString("campaign")
a, err := app.NewApp(campaignPath)
if err != nil {
fmt.Fprintln(os.Stderr, "ERROR: "+err.Error())
os.Exit(1)
@ -39,6 +41,8 @@ func RootCmd() *cobra.Command {
Short: "Create and manage Open Source campaigns",
}
cmd.PersistentFlags().String("campaign", "campaign.json", "the path to the campaign file")
cmd.AddCommand(
AddCmd(),
// FilterCmd(),