Add --campaign persistent flag
This commit is contained in:
parent
da89cad164
commit
7b1b61a582
1 changed files with 5 additions and 1 deletions
|
@ -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(),
|
||||
|
|
Loading…
Reference in a new issue