#!/usr/bin/env bash
#
# author: feihai
#* 
# 切换npm源码
#*

err() {
    printf 'error: %s\n' "$1" >&2
    exit 1
}

[[ $1 ]] || err "Usage: $0  <npm|taobao>    切换源到npm或淘宝镜像"

main() {
  [[ $1 == 'npm' ]] && npm config set registry https://registry.npmjs.org || npm config set registry https://registry.npm.taobao.org
}
main "$@"
