MakeCommand returns a `diff` command.
()
| 31 | |
| 32 | // MakeCommand returns a `diff` command. |
| 33 | func MakeCommand() *cobra.Command { |
| 34 | flags := &flags{} |
| 35 | cmd := &cobra.Command{ |
| 36 | Use: "diff [first] [second]", |
| 37 | Short: "Diffs two Go coverage files.", |
| 38 | Long: `Takes the difference between two Go coverage files, producing another Go coverage file |
| 39 | showing only what was covered between the two files being generated. This works best when using |
| 40 | files generated in "count" or "atomic" mode; "set" may drastically underreport. |
| 41 | |
| 42 | It is assumed that both files came from the same execution, and so all values in the second file are |
| 43 | at least equal to those in the first file.`, |
| 44 | Run: func(cmd *cobra.Command, args []string) { |
| 45 | run(flags, cmd, args) |
| 46 | }, |
| 47 | } |
| 48 | cmd.Flags().StringVarP(&flags.OutputFile, "output", "o", "-", "output file") |
| 49 | return cmd |
| 50 | } |
| 51 | |
| 52 | func run(flags *flags, cmd *cobra.Command, args []string) { |
| 53 | if len(args) != 2 { |