Skip to content

Commit

Permalink
dry-run added
Browse files Browse the repository at this point in the history
  • Loading branch information
Aziz Ishan-Khojaev committed Feb 13, 2024
1 parent 7ad9fe7 commit 1ad1451
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/genericcli/cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ func NewCmds[C any, U any, R any](c *CmdsConfig[C, U, R], additionalCmds ...*cob
return err
}

if viper.GetString("dry-run") == "client" {
fmt.Println("Create request as client:", rq)
return nil
} else if viper.GetString("dry-run") == "server" {
fmt.Println("Create request as server:", rq)
return nil
}

return c.GenericCLI.CreateAndPrint(rq, c.DescribePrinter())
}

Expand All @@ -182,6 +190,9 @@ func NewCmds[C any, U any, R any](c *CmdsConfig[C, U, R], additionalCmds ...*cob
},
}

//Adding dry-run flas to the command
cmd.Flags().String("dry-run", "", "Ser dry-run mode. Values: client, server")

c.addFileFlags(cmd)

if c.CreateCmdMutateFn != nil {
Expand Down

0 comments on commit 1ad1451

Please sign in to comment.