mirror of
https://github.com/asdf-vm/asdf.git
synced 2024-12-19 18:05:02 -07:00
9f09f78ec0
* Create primitive `toolversions.Intersect` function * Create `paths.RemoveFromPath` function * Create `shims.FindExecutable` function * Write tests
22 lines
529 B
Go
22 lines
529 B
Go
// Package paths contains a variety of helper functions responsible for
|
|
// computing paths to various things. This package should not depend on any
|
|
// other asdf packages.
|
|
package paths
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// RemoveFromPath returns the PATH without asdf shims path
|
|
func RemoveFromPath(currentPath, pathToRemove string) string {
|
|
var newPaths []string
|
|
|
|
for _, fspath := range strings.Split(currentPath, ":") {
|
|
if fspath != pathToRemove {
|
|
newPaths = append(newPaths, fspath)
|
|
}
|
|
}
|
|
|
|
return strings.Join(newPaths, ":")
|
|
}
|