mirror of
https://github.com/SeriousBug/dotfiles
synced 2024-12-26 12:49:56 -06:00
update fisher
This commit is contained in:
parent
dad8819b2a
commit
b1895ebdfc
|
@ -4,7 +4,7 @@ function _nvm_install --on-event nvm_install
|
||||||
set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
|
set --query nvm_mirror || set --universal nvm_mirror https://nodejs.org/dist
|
||||||
|
|
||||||
test ! -d $nvm_data && command mkdir -p $nvm_data
|
test ! -d $nvm_data && command mkdir -p $nvm_data
|
||||||
echo "Downloading the Node distribution index for the first time..." 2>/dev/null
|
echo "Downloading the Node distribution index..." 2>/dev/null
|
||||||
_nvm_index_update $nvm_mirror $nvm_data/.index
|
_nvm_index_update $nvm_mirror $nvm_data/.index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -23,6 +23,6 @@ function _nvm_uninstall --on-event nvm_uninstall
|
||||||
functions --erase (functions --all | string match --entire --regex -- "^_nvm_")
|
functions --erase (functions --all | string match --entire --regex -- "^_nvm_")
|
||||||
end
|
end
|
||||||
|
|
||||||
status is-interactive &&
|
if status is-interactive && set --query nvm_default_version && ! set --query nvm_current_version
|
||||||
set --query nvm_default_version && ! set --query nvm_current_version &&
|
|
||||||
nvm use $nvm_default_version >/dev/null
|
nvm use $nvm_default_version >/dev/null
|
||||||
|
end
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
function _nvm_index_update --argument-names mirror index
|
function _nvm_index_update --argument-names mirror index
|
||||||
command curl --location --silent $mirror/index.tab | command awk -v OFS=\t '
|
if not command curl --location --silent $mirror/index.tab >$index.temp
|
||||||
|
command rm -f $index.temp
|
||||||
|
echo "nvm: Can't update index, host unavailable: \"$mirror\"" >&2
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
|
||||||
|
command awk -v OFS=\t '
|
||||||
/v0.9.12/ { exit } # Unsupported
|
/v0.9.12/ { exit } # Unsupported
|
||||||
NR > 1 {
|
NR > 1 {
|
||||||
print $1 (NR == 2 ? " latest" : $10 != "-" ? " lts/" tolower($10) : "")
|
print $1 (NR == 2 ? " latest" : $10 != "-" ? " lts/" tolower($10) : "")
|
||||||
}
|
}
|
||||||
' >$index.temp 2>/dev/null && command mv $index.temp $index && return
|
' $index.temp >$index
|
||||||
|
|
||||||
command rm -f $index.temp
|
command rm -f $index.temp
|
||||||
echo "nvm: Invalid index or unavailable host: \"$mirror\"" >&2
|
|
||||||
return 1
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
function fisher --argument-names cmd --description "A plugin manager for Fish"
|
function fisher --argument-names cmd --description "A plugin manager for Fish"
|
||||||
set --query fisher_path || set --local fisher_path $__fish_config_dir
|
set --query fisher_path || set --local fisher_path $__fish_config_dir
|
||||||
set --local fisher_version 4.3.0
|
set --local fisher_version 4.3.1
|
||||||
set --local fish_plugins $__fish_config_dir/fish_plugins
|
set --local fish_plugins $__fish_config_dir/fish_plugins
|
||||||
|
|
||||||
switch "$cmd"
|
switch "$cmd"
|
||||||
|
@ -15,6 +15,8 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -v or --version Print version"
|
echo " -v or --version Print version"
|
||||||
echo " -h or --help Print this help message"
|
echo " -h or --help Print this help message"
|
||||||
|
echo "Variables:"
|
||||||
|
echo " \$fisher_path Plugin installation path. Default: ~/.config/fish"
|
||||||
case ls list
|
case ls list
|
||||||
string match --entire --regex -- "$argv[2]" $_fisher_plugins
|
string match --entire --regex -- "$argv[2]" $_fisher_plugins
|
||||||
case install update remove
|
case install update remove
|
||||||
|
@ -82,11 +84,12 @@ function fisher --argument-names cmd --description "A plugin manager for Fish"
|
||||||
else
|
else
|
||||||
set temp (command mktemp -d)
|
set temp (command mktemp -d)
|
||||||
set name (string split \@ $plugin) || set name[2] HEAD
|
set name (string split \@ $plugin) || set name[2] HEAD
|
||||||
set url https://codeload.github.com/\$name[1]/tar.gz/\$name[2]
|
set url https://api.github.com/repos/\$name[1]/tarball/\$name[2]
|
||||||
|
set header 'Accept: application/vnd.github.v3+json'
|
||||||
|
|
||||||
echo Fetching (set_color --underline)\$url(set_color normal)
|
echo Fetching (set_color --underline)\$url(set_color normal)
|
||||||
|
|
||||||
if curl --silent \$url | tar -xzC \$temp -f - 2>/dev/null
|
if curl --silent -L -H \$header \$url | tar -xzC \$temp -f - 2>/dev/null
|
||||||
command cp -Rf \$temp/*/* $source
|
command cp -Rf \$temp/*/* $source
|
||||||
else
|
else
|
||||||
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
echo fisher: Invalid plugin name or host unavailable: \\\"$plugin\\\" >&2
|
||||||
|
|
|
@ -9,9 +9,11 @@ function nvm --argument-names cmd v --description "Node version manager"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
set --local their_version $v
|
||||||
|
|
||||||
switch "$cmd"
|
switch "$cmd"
|
||||||
case -v --version
|
case -v --version
|
||||||
echo "nvm, version 2.2.5"
|
echo "nvm, version 2.2.7"
|
||||||
case "" -h --help
|
case "" -h --help
|
||||||
echo "Usage: nvm install <version> Download and activate the specified Node version"
|
echo "Usage: nvm install <version> Download and activate the specified Node version"
|
||||||
echo " nvm install Install version from nearest .nvmrc file"
|
echo " nvm install Install version from nearest .nvmrc file"
|
||||||
|
@ -35,7 +37,7 @@ function nvm --argument-names cmd v --description "Node version manager"
|
||||||
string match --entire --regex -- (_nvm_version_match $v) <$nvm_data/.index | read v alias
|
string match --entire --regex -- (_nvm_version_match $v) <$nvm_data/.index | read v alias
|
||||||
|
|
||||||
if ! set --query v[1]
|
if ! set --query v[1]
|
||||||
echo "nvm: Invalid version number or alias: \"$argv[2..-1]\"" >&2
|
echo "nvm: Invalid version number or alias: \"$their_version\"" >&2
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -114,7 +116,7 @@ function nvm --argument-names cmd v --description "Node version manager"
|
||||||
_nvm_list | string match --entire --regex -- (_nvm_version_match $v) | read v __
|
_nvm_list | string match --entire --regex -- (_nvm_version_match $v) | read v __
|
||||||
|
|
||||||
if ! set --query v[1]
|
if ! set --query v[1]
|
||||||
echo "nvm: Node version not installed or invalid: \"$argv[2..-1]\"" >&2
|
echo "nvm: Can't use Node \"$their_version\", version must be installed first" >&2
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -135,7 +137,7 @@ function nvm --argument-names cmd v --description "Node version manager"
|
||||||
_nvm_list | string match --entire --regex -- (_nvm_version_match $v) | read v __
|
_nvm_list | string match --entire --regex -- (_nvm_version_match $v) | read v __
|
||||||
|
|
||||||
if ! set -q v[1]
|
if ! set -q v[1]
|
||||||
echo "nvm: Node version not installed or invalid: \"$argv[2..-1]\"" >&2
|
echo "nvm: Node version not installed or invalid: \"$their_version\"" >&2
|
||||||
return 1
|
return 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue