Skip to content

Commit 781bd55

Browse files
committed
chore: added printline with
1 parent ea736c2 commit 781bd55

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ func main() {
2424
var remainingArgs = commandRun.FilterArgs(args[1:])
2525

2626
if cmdFlags.Env {
27-
print(shell.ShowEnv(cwd))
28-
os.Exit(0)
27+
shell.ShowEnv(cwd)
28+
return
2929
}
3030

3131
if len(remainingArgs) == 0 {

shell/showEnv.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
package shell
22

33
import (
4+
"fmt"
5+
"os"
46
"strings"
57

68
"github.com/samtv12345/gnpm/filemanagement"
79
)
810

9-
func ShowEnv(cwd string) string {
11+
func ShowEnv(cwd string) {
1012
currentParent, err := filemanagement.FindParentLinkModuleDir(cwd)
1113
if err != nil {
1214
panic(err)
@@ -16,12 +18,14 @@ func ShowEnv(cwd string) string {
1618
panic(err)
1719
}
1820
if strings.Contains(currentShell, "cmd.exe") {
19-
return "set PATH=" + *currentParent + ";%PATH%"
21+
println("set PATH=" + *currentParent + ";%PATH%")
22+
return
2023
}
2124

2225
if strings.Contains(currentShell, "powershell.exe") {
23-
return "$env:PATH=\"" + *currentParent + ";$env:PATH\""
26+
println("$env:PATH=\"" + *currentParent + ";$env:PATH\"")
27+
return
2428
}
2529

26-
return "export PATH=" + *currentParent + ":$PATH"
30+
fmt.Printf("export PATH=%s:%s\n", *currentParent, os.Getenv("PATH"))
2731
}

0 commit comments

Comments
 (0)