更新时间:2024-04-18 GMT+08:00
分享

查询配置项列表中的custom参数

查询KooCLI配置项列表中的custom参数的命令如下,查询结果支持以table,json或tsv格式输出,默认以json格式输出:

hcloud configure list --cli-custom=true

hcloud configure list --cli-custom=true
{
  "current": "test",
  "profiles": [
    {
      "name": "default",
      "custom": {}
    },
    {
      "name": "test",
      "custom": {
        "password": {
          "value": "****",
          "isEncrypted": true
        },
        "projectId": {
          "value": "06810000000000000000000000f89d2e",
          "isEncrypted": false
        }
      }
    }
  ]
}

其中,加密保存的custom参数值会被匿名化展示

可以使用“--cli-query”对查询结果进行过滤,使用“--cli-query”时,默认以json格式输出,可同时使用“--cli-output”指定输出格式。例如以json格式输出,查询名称为test的配置项的所有custom参数:

hcloud configure list --cli-custom=true --cli-query="profiles[?name=='test'].custom" --cli-output=json
[
  {
    "password": {
      "isEncrypted": true,
      "value": "****"
    },
    "projectId": {
      "isEncrypted": false,
      "value": "06810000000000000000000000f89d2e"
    }
  }
]
分享:

    相关文档

    相关产品