MakeCommand returns a `diff` command.
()
| 34 | |
| 35 | // MakeCommand returns a `diff` command. |
| 36 | func MakeCommand() *cobra.Command { |
| 37 | flags := &flags{} |
| 38 | cmd := &cobra.Command{ |
| 39 | Use: "diff [base-profile] [new-profile]", |
| 40 | Short: "Calculate the file level difference between two coverage profiles", |
| 41 | Long: `Calculate the file level difference between two coverage profiles. |
| 42 | Produce the result in a markdown table`, |
| 43 | Run: func(cmd *cobra.Command, args []string) { |
| 44 | run(flags, cmd, args) |
| 45 | }, |
| 46 | } |
| 47 | cmd.Flags().StringVarP(&flags.outputFile, "output", "o", "-", "output file") |
| 48 | cmd.Flags().StringVarP(&flags.jobName, "jobname", "j", "", "prow job name") |
| 49 | cmd.Flags().Float32VarP(&flags.threshold, "threshold", "t", .8, "code coverage threshold") |
| 50 | return cmd |
| 51 | } |
| 52 | |
| 53 | func run(flags *flags, cmd *cobra.Command, args []string) { |
| 54 | if len(args) != 2 { |