-
Notifications
You must be signed in to change notification settings - Fork 2
/
resolvedtool.go
39 lines (34 loc) · 1.02 KB
/
resolvedtool.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package diff
import (
"fmt"
"github.com/VerifyTests/Verify.Go/utils"
)
// ResolvedTool contains information about a found diff tool
type ResolvedTool struct {
Name string
Kind ToolKind
ExePath string
RightArguments BuildArguments
LeftArguments BuildArguments
IsMdi bool
AutoRefresh bool
BinaryExtensions []string
RequiresTarget bool
SupportsText bool
}
func (r *ResolvedTool) buildCommand(tempFile, targetFile string) string {
return fmt.Sprintf("\"%s\" %s", r.ExePath, r.getArguments(tempFile, targetFile))
}
func (r *ResolvedTool) commandAndArguments(tempFile, targetFile string) (arguments []string, command string) {
arguments = r.getArguments(tempFile, targetFile)
command = r.ExePath
return
}
func (r *ResolvedTool) getArguments(tempFile, targetFile string) []string {
tmp := utils.File.GetFullPath(tempFile)
tgt := utils.File.GetFullPath(targetFile)
if position.TargetOnLeft {
return r.LeftArguments(tmp, tgt)
}
return r.RightArguments(tmp, tgt)
}