From 4f90ae2a9c85e1fae55381497bedd0ca43ca8fb6 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 22 Jan 2021 10:07:48 +0800 Subject: [PATCH 1/2] [misc] go back to yarn --- devel/nodejs.sh | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/devel/nodejs.sh b/devel/nodejs.sh index e3840fa..31c3524 100755 --- a/devel/nodejs.sh +++ b/devel/nodejs.sh @@ -60,8 +60,23 @@ install() { | sudo tee "$FILES_PATH" >/dev/null # remove download path rm "/tmp/$NAME" + sudo npm install -g yarn if in_china; then - sudo npm install -g cnpm --registry=https://registry.npm.taobao.org + #sudo npm install -g cnpm --registry=https://registry.npm.taobao.org + yarnpkg config set registry https://registry.npm.taobao.org --global && \ + yarnpkg config set disturl https://npm.taobao.org/dist --global && \ + yarnpkg config set sass_binary_site https://npm.taobao.org/mirrors/node-sass --global && \ + yarnpkg config set electron_mirror https://npm.taobao.org/mirrors/electron/ --global && \ + yarnpkg config set puppeteer_download_host https://npm.taobao.org/mirrors --global && \ + yarnpkg config set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver --global && \ + yarnpkg config set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver --global && \ + yarnpkg config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs --global && \ + yarnpkg config set selenium_cdnurl https://npm.taobao.org/mirrors/selenium --global && \ + yarnpkg config set sqlite3_binary_host_mirror https://foxgis.oss-cn-shanghai.aliyuncs.com/ --global && \ + yarnpkg config set profiler_binary_host_mirror https://npm.taobao.org/mirrors/node-inspector/ --global && \ + yarnpkg config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver --global && \ + yarnpkg config set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector --global && \ + yarnpkg config set sentrycli_cdnurl https://npm.taobao.org/mirrors/sentry-cli fi if enhance_vim; then v -c "CocInstall -sync coc-json coc-vetur coc-tsserver coc-eslint|qall" @@ -85,17 +100,3 @@ case "$1" in esac -#yarnpkg config set registry https://registry.npm.taobao.org --global && \ -#yarnpkg config set disturl https://npm.taobao.org/dist --global && \ -#yarnpkg config set sass_binary_site https://npm.taobao.org/mirrors/node-sass --global && \ -#yarnpkg config set electron_mirror https://npm.taobao.org/mirrors/electron/ --global && \ -#yarnpkg config set puppeteer_download_host https://npm.taobao.org/mirrors --global && \ -#yarnpkg config set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver --global && \ -#yarnpkg config set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver --global && \ -#yarnpkg config set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs --global && \ -#yarnpkg config set selenium_cdnurl https://npm.taobao.org/mirrors/selenium --global && \ -#yarnpkg config set sqlite3_binary_host_mirror https://foxgis.oss-cn-shanghai.aliyuncs.com/ --global && \ -#yarnpkg config set profiler_binary_host_mirror https://npm.taobao.org/mirrors/node-inspector/ --global && \ -#yarnpkg config set chromedriver_cdnurl https://cdn.npm.taobao.org/dist/chromedriver --global && \ -#yarnpkg config set node_inspector_cdnurl https://npm.taobao.org/mirrors/node-inspector --global && \ -#yarnpkg config set sentrycli_cdnurl https://npm.taobao.org/mirrors/sentry-cli From 75dcda2e82c58f7d5b7d59919e6c7d411f2ef41e Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Fri, 22 Jan 2021 11:18:14 +0800 Subject: [PATCH 2/2] [feature] udpate bookmark link --- bin/bm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bin/bm b/bin/bm index 38d2872..40bb2b2 100755 --- a/bin/bm +++ b/bin/bm @@ -46,6 +46,21 @@ function open end end +function update + set url (xsel -ob) + if ! string match 'http*' $url + echo "no url found on clipboard" + exit 1 + end + set query (sed -r '/^(#.*|\s*)$/d' $BOOKMARK_PATH | $BOOKMARK_SEARCHER) + echo url: $url + echo query: $query + mv $BOOKMARK_PATH $BOOKMARK_PATH.bak + awk '$0 == "'$query'" { + sub(/\(http.*\)/, "('$url')") + } { print }' $BOOKMARK_PATH.bak > $BOOKMARK_PATH +end + function _filter_category if not count $argv >/dev/null cat - @@ -105,7 +120,7 @@ function _search end switch $argv[1] - case open list help + case open list help update $argv[1..-1] case '*' _search