Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Clivern committed Jul 12, 2022
1 parent cdb487b commit a6458cc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ Add `goenv` shims to `PATH` using the following command. also append it to `~/.p

```zsh
$ export PATH="$HOME/.goenv/shims:"$PATH

# OR

$ eval "$(goenv init)"
```

Install a new `go` version `1.18` and set as a global
Expand Down Expand Up @@ -102,9 +106,11 @@ Available Commands:
global Set or show the global go version.
help Help about any command
info Print the goenv version
init Init the import path for goenv shims.
install Install a go version.
license Print the license
local Set or show the local application-specific go version.
rehash Refresh binaries under goenv shim directory.
uninstall Uninstall a specific go version.
version Show the current go version.
versions List installed go versions.
Expand Down
32 changes: 32 additions & 0 deletions cmd/init.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2022 Clivern. All rights reserved.
// Use of this source code is governed by the MIT
// license that can be found in the LICENSE file.

package cmd

import (
"fmt"

"github.com/clivern/goenv/core/module"

"github.com/spf13/cobra"
)

var initCmd = &cobra.Command{
Use: "init",
Short: "Init the import path for goenv shims.",
Run: func(cmd *cobra.Command, args []string) {

if HOME == "" {
return
}

golang := module.NewGolangEnvironment(HOME)

fmt.Printf("export PATH=\"%s/%s:${PATH}\"\n", golang.RootPath, golang.ShimsDir)
},
}

func init() {
rootCmd.AddCommand(initCmd)
}

0 comments on commit a6458cc

Please sign in to comment.