跳到主要内容

全局参数

以下参数适用于所有 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-inputbooleanfalse从不提示输入,缺少输入时立即失败(等同于 SHOPLAZZA_CLI_NO_INTERACTIVE=1)
--help / -hboolean—显示命令帮助

--version / -v 仅在根命令上可用(shoplazza --version)。

命令参数​

以下参数不是全局参数,只存在于所列命令上。

参数类型默认值适用命令说明
--jq <表达式>string—API 命令、快捷命令、api rest、schema使用 jq 表达式过滤 JSON 输出。需要 JSON 输出,在交互式终端中要加 --format json
-q <表达式>string—同 --jq--jq 的简写别名
--dry-runbooleanfalseAPI 命令、快捷命令、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
在此页面