Documentation ¶
Overview ¶
commands holds all flagset commands for nvm:
- install
- use
- list
- uninstall
- which
Example
nvm install 18.0.0 nvm use 18.0.0 node -v // v18.0.0
Index ¶
- Constants
- Variables
- func CheckSha(fileName string, node_body, sha_body []byte) error
- func Download(url string, ch chan []byte, err_ch chan error)
- func GetDownloadUrl(v common.Version, d exclusive_node_file) string
- func GetOsAndArch() (remote_os, remote_arch string)
- func Install(args []string) (err error)
- func List(cmd string, args []string) (err error)
- func Uninstall(args []string) (err error)
- func Use(args []string) (err error)
- func Which(cmd string, args []string) (err error)
- type NodeDownload
Constants ¶
const DEFAULT_BASE_URL = "https://nodejs.org/dist"
default download location
const SHASUMS = "SHASUMS256.txt"
remote filename which indicates sha's for each downloadable file
Variables ¶
var BASE_URL = os.Getenv("NVM_NODEJS_ORG_MIRROR")
NVM_NODEJS_ORG_MIRROR - base url for downloading node; default: "https://nodejs.org/dist"
var InstallCmd = flag.NewFlagSet("install", flag.ContinueOnError)
flag set for commands.Install
var ListCmd = flag.NewFlagSet("list", flag.ContinueOnError)
flag set for commands.List
var UninstallCmd = flag.NewFlagSet("uninstall", flag.ContinueOnError)
flag set for commands.Uninstall
var UseCmd = flag.NewFlagSet("use", flag.ContinueOnError)
flag set for commands.Use
var WhichCmd = flag.NewFlagSet("which", flag.ContinueOnError)
flag set for commands.Which
Functions ¶
func Download ¶
actually downloads a url and passes the []bytes to the channel; if there is an error, we pass it to `err_ch` used by commands.Install
func GetDownloadUrl ¶
determine where to download node install files
`v` a verified/parsed version string
`d` is a commands.NodeDownload
used by commands.Install
func GetOsAndArch ¶
func GetOsAndArch() (remote_os, remote_arch string)
TODO: this can be cached, or run once used to determine download url in commands.GetDownloadUrl
func Install ¶
install a given node version TODO: install should output success message TODO: nvm install -h outputs help text twice TODO: install should always update/create symlinks in .nevermind/bin
Types ¶
type NodeDownload ¶
type NodeDownload int
Enum for downloading either node or shasums
const ( DOWNLOAD_NODE NodeDownload = iota // downloads node DOWNLOAD_SHASUM // downloads SHASUMS )