~crg/config

3cba2df6446f0e0c57e594c478007056cb27a3e8 — Charles Gould 1 year, 4 months ago aad67c4
fish: bump nvm.fish to 2.2.13
3 files changed, 34 insertions(+), 30 deletions(-)

M fish/completions/nvm.fish
M fish/conf.d/nvm.fish
M fish/functions/nvm.fish
M fish/completions/nvm.fish => fish/completions/nvm.fish +5 -5
@@ 4,15 4,15 @@ complete --command nvm --exclusive --long help --description "Print help"
complete --command nvm --long silent --description "Suppress standard output"

complete --command nvm --exclusive --condition __fish_use_subcommand --arguments install --description "Download and activate the specified Node version"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments use --description "Activate a version in the current shell"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list --description "List installed versions"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list-remote --description "List versions available to install matching optional regex"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments current --description "Print the currently-active version"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments use --description "Activate the specified Node version in the current shell"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list --description "List installed Node versions"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments list-remote --description "List available Node versions to install"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments current --description "Print the currently-active Node version"
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from install" --arguments "(
    test -e $nvm_data && string split ' ' <$nvm_data/.index
)"
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from use" --arguments "(_nvm_list | string split ' ')"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments uninstall --description "Uninstall a version"
complete --command nvm --exclusive --condition __fish_use_subcommand --arguments uninstall --description "Uninstall the specified Node version"
complete --command nvm --exclusive --condition "__fish_seen_subcommand_from uninstall" --arguments "(
    _nvm_list | string split ' ' | string replace system ''
)"

M fish/conf.d/nvm.fish => fish/conf.d/nvm.fish +7 -7
@@ 1,17 1,17 @@
function _nvm_install --on-event nvm_install
    set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
    set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
    set --universal nvm_data $XDG_DATA_HOME/nvm
set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist
set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
set --global nvm_data $XDG_DATA_HOME/nvm

function _nvm_install --on-event nvm_install
    test ! -d $nvm_data && command mkdir -p $nvm_data
    echo "Downloading the Node distribution index..." 2>/dev/null
    _nvm_index_update
end

function _nvm_update --on-event nvm_update
    set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
    set --query XDG_DATA_HOME || set --local XDG_DATA_HOME ~/.local/share
    set --universal nvm_data $XDG_DATA_HOME/nvm
    set --query --universal nvm_data && set --erase --universal nvm_data
    set --query --universal nvm_mirror && set --erase --universal nvm_mirror
    set --query nvm_mirror || set --global nvm_mirror https://nodejs.org/dist
end

function _nvm_uninstall --on-event nvm_uninstall

M fish/functions/nvm.fish => fish/functions/nvm.fish +22 -18
@@ 29,26 29,31 @@ function nvm --description "Node version manager"

    switch "$cmd"
        case -v --version
            echo "nvm, version 2.2.11"
            echo "nvm, version 2.2.13"
        case "" -h --help
            echo "Usage: nvm install <version>    Download and activate the specified Node version"
            echo "       nvm install              Install version from nearest .nvmrc file"
            echo "       nvm use <version>        Activate a version in the current shell"
            echo "       nvm use                  Activate version from nearest .nvmrc file"
            echo "       nvm list                 List installed versions"
            echo "       nvm list-remote          List versions available to install"
            echo "       nvm list-remote <regex>  List versions matching a given regular expression"
            echo "       nvm current              Print the currently-active version"
            echo "       nvm uninstall <version>  Uninstall a version"
            echo "       nvm install              Install the version specified in the nearest .nvmrc file"
            echo "       nvm use <version>        Activate the specified Node version in the current shell"
            echo "       nvm use                  Activate the version specified in the nearest .nvmrc file"
            echo "       nvm list                 List installed Node versions"
            echo "       nvm list-remote          List available Node versions to install"
            echo "       nvm list-remote <regex>  List Node versions matching a given regex pattern"
            echo "       nvm current              Print the currently-active Node version"
            echo "       nvm uninstall <version>  Uninstall the specified Node version"
            echo "Options:"
            echo "       -s or --silent           Suppress standard output"
            echo "       -v or --version          Print version"
            echo "       -h or --help             Print this help message"
            echo "       -s, --silent             Suppress standard output"
            echo "       -v, --version            Print the version of nvm"
            echo "       -h, --help               Print this help message"
            echo "Variables:"
            echo "       nvm_arch                 Override architecture, e.g. x64-musl"
            echo "       nvm_mirror               Use a mirror of the Node binaries"
            echo "       nvm_mirror               Use a mirror for downloading Node binaries"
            echo "       nvm_default_version      Set the default version for new shells"
            echo "       nvm_default_packages     Install a list of packages every time you install a Node version"
            echo "       nvm_default_packages     Install a list of packages every time a Node version is installed"
            echo "Examples:"
            echo "       nvm install latest       Install the latest version of Node"
            echo "       nvm use 14.15.1          Use Node version 14.15.1"
            echo "       nvm use system           Activate the system's Node version"

        case install
            _nvm_index_update



@@ 195,8 200,7 @@ end
function _nvm_version_match --argument-names ver
    string replace --regex -- '^v?(\d+|\d+\.\d+)$' 'v$1.' $ver |
        string replace --filter --regex -- '^v?(\d+)' 'v$1' |
        string escape --style=regex ||
        string lower '\b'$ver'(?:/\w+)?$'
        string escape --style=regex || string lower '\b'$ver'(?:/\w+)?$'
end

function _nvm_list_format --argument-names current regex


@@ 225,6 229,6 @@ function _nvm_node_info
    command node --eval "
        console.log(process.version)
        console.log('$npm_version_default' ? '$npm_version_default': require('$npm_path/package.json').version)
        console.log(process.execPath.replace(require('os').homedir(), '~'))
    "
        console.log(process.execPath)
    " | string replace -- ~ \~
end