CLI 参考
pikeway keys activate
选择 CLI 默认使用哪把已保存的 key。
用法
bash
pikeway keys activate --label <label> [--json]
说明
在本地配置文件中把该标签的 key 标记为当前 key。之后所有需要 key 的命令都会使用它,除非传了 --key 或设置了 PIKEWAY_API_KEY。不会连接网关。
参数
--labelstring必填已保存 key 的标签,即
pikeway keys list 显示的名称。示例
bash
# switch to the CI key pikeway keys activate --label ci # confirm which account it belongs to pikeway keys activate --label ci && pikeway whoami # one command with another key, without switching pikeway balance --key pk-...
输出
text
active key: ci
--json
json
{ "active": "ci" }错误与退出码
| 退出码 | 错误信息 | 触发条件 |
|---|---|---|
| 2 | missing --label | 没有传 --label 或没有给值。 |
| 2 | no key labelled "ci" | 没有该标签的已保存 key。请用 pikeway keys list 确认。 |
如果设置了
PIKEWAY_API_KEY,它的优先级仍高于刚激活的 key。见 API key 的确定顺序。