npm-proxy-manager is a command-line tool for managing npm proxies, providing quick enable and disable proxy functionalities.
npm install npm-proxy-managernpm-proxy-manager 是一个用于管理 npm 代理的命令行工具,它提供快捷的 开启、关闭、切换 代理等功能。
npm-proxy-manager 以如下方式存储您的自定义代理:
``sh
[proxy1]
proxy=http://test/proxy1
https-proxy=http://test/https-proxy1
[proxy2]
proxy=http://test/proxy2
https-proxy=http://test/https-proxy2
`
通过 np open 和 np close 命令,你可以方便地开启与关闭代理;
通过 np use 命令(如:np use proxy1),你可以方便地切换代理。
请确保你已经安装了 Node.js 和 npm,然后运行以下命令来安装依赖:
`sh`
npm install -g npm-proxy-manager
添加自定义代理 proxy1
`sh`
np add proxy1 http://test/proxy1
列出所有已添加的代理
`sh`
np ls
使用(切换)代理 proxy1
`sh`
np use proxy1
禁用代理
`sh`
np close
启用代理(继续使用 proxy1)
`sh`
np open
注意:下述命令中,np 是 npm-proxy 的简写,你也可以书写全称。
`sh`
np add
默认情况下,np add \
仅设置 http proxy
`sh`
np add
仅设置 https proxy
`sh`
np add
`sh`
np ls
or
np list
输出示例:
`sh`
proxy1 ---- [proxy] http://test/proxy ---- [https-proxy] https://test/https-proxy
proxy2 ---- [proxy] http://test/proxy ---- [https-proxy] https://test/https-proxy
默认情况下,np ls 会把 http proxy 与 https proxy 都列举出来,你可以使用 -p 和 -hp 命令单独列举 http proxy 和 https proxy,如下:
仅列举 http proxy
`sh`
np ls -p
输出示例:
`sh`
proxy1 ---- http://test/proxy
proxy2 ---- http://test/proxy
仅列举 https proxy
`sh`
np ls -hp
输出示例:
`sh`
proxy1 ---- https://test/https-proxy
proxy2 ---- https://test/https-proxy
通过 np use \
`sh`
np use
默认情况下,np use \
仅应用 \
`sh`
np use
仅应用 \
`sh`
np use
`sh`
np close
默认情况下,np close 会同时关闭 http proxy 与 https proxy,你可以使用 -p 和 -hp 命令仅关闭 http proxy 或 https proxy,如下:
仅关闭 http proxy
`sh`
np close -p
仅关闭 https proxy
`sh`
np close -hp
`sh`
np open
默认情况下,np open 会同时开启 http proxy 与 https proxy,你可以使用 -p 和 -hp 命令仅开启 http proxy 或 https proxy,如下:
仅开启 http proxy
`sh`
np open -p
仅开启 https proxy
`sh`
np open -hp
`sh`
np del
or
np delete
`sh`
np rename
`sh`
np set
默认情况下,np set \
仅设置 http proxy
`sh`
np set
仅设置 https proxy
`sh`
np set
`sh`
np cur
or
np current
默认情况下,np cur 会同时列举当前正在使用的 http proxy 与 https proxy,你可以使用 -p 和 -hp 命令仅列举 http proxy 或 https proxy,如下:
仅列举当前正在使用的 http proxy
`sh`
np cur -p
仅列举当前正在使用的 https proxy
`sh``
np cur -hp
MIT