MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / GetCliPath

Function GetCliPath

test/integration/integrationtestutil.go:33–55  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31}
32
33func GetCliPath() (cliPath string, cliDir string, err error) {
34 _, fileName, _, ok := runtime.Caller(1)
35 if ok {
36 // we expect to be in <base>\integrationtest
37 // we expect the CLI executable to be in <base>\cmd\octopus
38 myDir := path.Dir(fileName)
39 cliDir = path.Join(myDir, "../..", "cmd", "octopus")
40 if _, err = os.Stat(cliDir); os.IsNotExist(err) {
41 err = fmt.Errorf("expected directory %s not found", cliDir)
42 return
43 }
44
45 //goland:noinspection GoBoolExpressions
46 if runtime.GOOS == "windows" {
47 cliPath = path.Join(cliDir, "octopus.exe")
48 } else {
49 cliPath = path.Join(cliDir, "octopus")
50 }
51 } else {
52 err = errors.New("can't get runtime.caller(1)")
53 }
54 return
55}
56
57var ensureCliHasRun = false
58

Callers 1

EnsureCliFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected