Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path separator as colon on pwsh Linux #82

Merged
merged 2 commits into from
May 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions cmd/gvm/internal/shellfmt/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,21 @@ func (*batchFormatter) Append(name, val string) string {
return fmt.Sprintf(`set %v=%v;%v`, name, os.Getenv(name), val)
}

func getWindowsPathSeparator() string {
if runtime.GOOS == "windows" {
return ";"
}
return ":"
}

func (*powershellFormatter) Set(name, val string) string {
return fmt.Sprintf(`$env:%v = "%v"`, name, val)
}

func (*powershellFormatter) Prepend(name, val string) string {
return fmt.Sprintf(`$env:%v = "%v;$env:%v"`, name, val, name)
return fmt.Sprintf(`$env:%v = "%v%v$env:%v"`, name, val, getWindowsPathSeparator(), name)
}

func (*powershellFormatter) Append(name, val string) string {
return fmt.Sprintf(`$env:%v="$env:%v;%v"`, name, name, val)
return fmt.Sprintf(`$env:%v="$env:%v%v%v"`, name, name, getWindowsPathSeparator(), val)
andrewkroh marked this conversation as resolved.
Show resolved Hide resolved
}
Loading