Skip to content

Commit

Permalink
Add a message after use and unuse to clear cached program location
Browse files Browse the repository at this point in the history
  • Loading branch information
navilg committed May 5, 2023
1 parent b2166e0 commit 659d3f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions internal/unuse/unuse.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"os"
"runtime"

"github.com/navilg/k8senv/internal/config"
)
Expand All @@ -22,6 +23,11 @@ func UnuseVersions(toolname string) error {
if err != nil {
fmt.Println("Failed to unuse", toolname)
fmt.Println("Due to,", err)
return err
}
if runtime.GOOS == "linux" {
fmt.Println(toolname, "successfully set to unuse.")
fmt.Println("Bash shell caches the program location. You might need to run 'hash -d " + toolname + "' to clear it for this to work.")
}
}

Expand Down
7 changes: 6 additions & 1 deletion internal/use/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"os"
"runtime"
"strings"

"github.com/navilg/k8senv/internal/config"
Expand Down Expand Up @@ -50,7 +51,11 @@ func UseVersion(toolname, version string) error {
return (err)
}

fmt.Println("Using", toolname, version, "as default.")
if runtime.GOOS == "linux" {

fmt.Println("Using", toolname, version, "as default.")
fmt.Println("Bash shell caches the program location. You might need to run 'hash -d " + toolname + "' to clear it for this to work.")
}

return nil
}

0 comments on commit 659d3f2

Please sign in to comment.