全局参数
以下参数适用于所有 Shoplazza CLI 命令。
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
--format <格式> | string | 自动 | 输出格式:json、pretty、table、ndjson 或 csv。在交互式终端中默认 pretty;stdout 被管道或重定向、在 CI 中或带 --no-input 时默认 json;SHOPLAZZA_CLI_FORMAT 可固定默认值 |
--profile <名称> | string | — | 本次调用使用的 profile(优先于 SHOPLAZZA_CLI_PROFILE 和当前 profile) |
--no-input | boolean | false | 从不提示输入,缺少输入时立即失败(等同于 SHOPLAZZA_CLI_NO_INTERACTIVE=1) |
--help / -h | boolean | — | 显示命令帮助 |
--version / -v 仅在根命令上可用(shoplazza --version)。
命令参数
以下参数不是全局参数,只存在于所列命令上。
| 参数 | 类型 | 默认值 | 适用命令 | 说明 |
|---|---|---|---|---|
--jq <表达式> | string | — | API 命令、快捷命令、api rest、schema | 使用 jq 表达式过滤 JSON 输出。需要 JSON 输出,在交互式终端中要加 --format json |
-q <表达式> | string | — | 同 --jq | --jq 的简写别名 |
--dry-run | boolean | false | API 命令、快捷命令、api rest、themes push / pull / share、checkout-extension deploy / list / preview / undeploy / versions | 预览请求,不实际执行 |
--params <json> | string | — | API 命令、api rest | 路径参数和查询参数的 JSON |
--data <json> | string | — | 带请求体的 API 命令、api rest | 请求体 JSON(内联、@file 或 - 读 stdin) |
--fields <字段> | string | — | products +search | 逗号分隔的商品字段,让 API 只返回这些字段 |
示例
shell
shoplazza products list --format table
shoplazza orders +search --format pretty
shoplazza products list --format json --jq '.data.products[] | {id, title, price_min}'
shoplazza products create --data '{"product": {"title": "测试"}}' --dry-run
shoplazza products +search --fields "id,title,price_min" --format table
shoplazza products list --profile prod-us