Skip to content

Commit

Permalink
fixes uninstall
Browse files Browse the repository at this point in the history
  • Loading branch information
leucos committed Apr 25, 2022
1 parent d3319e0 commit df6a791
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 20 deletions.
13 changes: 13 additions & 0 deletions SYSTEM.md
Expand Up @@ -28,6 +28,9 @@ To run in global mode, you can either install from [scratch](#installation), or
Note that operations that mutate state (i.e. `install`, `uninstall`, `update`,
`upgrade`) will have to be executed as `root`.

Note that it is recommended to set `BINENV_GLOBAL=true` if you intend to
use mostly system-wide mode (see [Caveat](#caveat)).

## Installation

Note: instructions for BSD systems have not been tested.
Expand Down Expand Up @@ -123,6 +126,16 @@ binenv -g install binenv

- adjust path in your rcfiles according to your preferences

## Caveat

To use system-wide installed binaries, you have to set the `BINENV_GLOBAL=true`
environment variable.

This is required since binenv shim will look in default, user-related paths if
this is not set.

## FAQ

### Why do I have to use `-g` ? Can't binenv autodetect global mode ?

Yes it could. But what if you want to use a user installation along a global
Expand Down
13 changes: 0 additions & 13 deletions cmd/root.go
Expand Up @@ -100,19 +100,6 @@ selected.`,
return rootCmd
}

func truthify(s string) bool {
s = strings.ToLower(s)
// trueness suggestions courtesy of Github co-pilot
return s == "true" || s == "1" || s == "yes" || s == "y" || s == "on" || s == "enable" || s == "enabled" || s == "active"
}

// func envOrDefault(k, def string) string {
// if v := os.Getenv(k); v != "" {
// return v
// }
// return def
// }

func initializeConfig(cmd *cobra.Command) error {
v := viper.New()

Expand Down
8 changes: 1 addition & 7 deletions internal/app/app.go
Expand Up @@ -510,7 +510,7 @@ func (a *App) uninstall(dist, version string) error {
}
}

lnk := filepath.Join(a.bindir, dist)
lnk := filepath.Join(a.linkdir, dist)
if err = os.Remove(lnk); err != nil {
return err
}
Expand Down Expand Up @@ -827,12 +827,6 @@ func (a *App) CreateShimFor(dist string) error {
func (a *App) Execute(args []string) {
dist := filepath.Base(args[0])

a.logger.Debug().
Str("bindir", a.bindir).
Str("cachedir", a.cachedir).
Str("configdir", a.configdir).
Msg("directory settings")

// Check if args[0] is managed by us. If not write an error and exit. This
// should not happen since, if we are here, we must have used a symlink to
// the shim.
Expand Down

0 comments on commit df6a791

Please sign in to comment.