Debian Codegraph @

reporters/vscode.go

raw
1 package reporters
2
3 import (
4 "runtime"
5 )
6
7 type vsCode struct{}
8
9 // NewVSCodeReporter creates a new reporter for the Visual Studio Code diff tool.
10 func NewVSCodeReporter() Reporter {
11 return &vsCode{}
12 }
13
14 func (s *vsCode) Report(approved, received string) bool {
15 xs := []string{"-d", received, approved}
16 var programName string
17 switch runtime.GOOS {
18 case "windows":
19 programName = "C:/Program Files/Microsoft VS Code/Code.exe"
20 case "darwin":
21 programName = "/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code"
22 }
23
24 return launchProgram(programName, approved, xs...)
25 }