Skip to content

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 22 Aug 09:53
· 5 commits to main since this release
v0.2.0
d5384f8

变更

  • 命令行前端从 urfave/cli 整体迁移到 xyz-go v0.2.4:ls/stat/cat/presign/find 与
    HTTP/MCP 共享同一份命令定义(一个 args 结构体 + 一个 handler),cp/serve/mcp
    为 CLI 专有命令注册于同一注册表;urfave 依赖已从 go.mod 移除
  • 自定义中间件恢复原 CLI 行为:--color 偏好、-j/--json 注入、流式输出跳过框架渲染、
    错误行带 "oss: " 前缀(彩色仅在开启彩色时)
  • 根帮助保持自绘 dns 风格双语排版(命令表改为从注册表实时生成,永不漂移);
    各子命令 -h:xyz 模板 + 双语说明与全部示例(CliHints 的 Description/After 块)
  • xyz-go v0.2.4 升级带来的 shell 补全(oss completion bash|zsh|fish)

保持不变(逐项回归验证)

  • 六命令的参数名/别名/缩写/默认值全部不变;ls 的 PRE 行/彩色/NDJSON/分页缓存/页脚提示、
    find 的流式命中/导出/NDJSON 汇总、cp 的进度条与原子落盘、serve/mcp——与 v0.1.16 一致

无法完全一致的部分(原因逐项说明)

  1. find 多位置参数:oss find a b c 报"位置参数数量不符"退出 2——xyz 的位置参数
    个数固定(不支持变长)。改法:位置参数给第一个,其余用重复 --inputs 或 stdin
    (单输入 + stdin 用法完全不变)
  2. 用法错误退出码 1→2:未知 flag、位置参数数量不符等用法类错误按 xyz 语义退出 2
    (运行时错误仍为 1);Flag 解析错误的提示由 xyz 输出(其中"位置参数数量不符"为库内
    中文文案,未做双语)
  3. 帮助版式:各子命令 -h 的 flag 列表由 xyz 渲染(自带 (default …)/别名提示,样式
    与 urfave 不同);双语示例保留在帮助末尾。-v/--version 变为单行
    "oss version X"(原为两行且带仓库地址;仓库地址在 oss -h 中)
  4. 逗号拆分取消:--include a,b 不再拆成两个值(xyz 重复 flag 语义)——多个值用
    重复的 --include a --include b;HTTP/MCP 接口与此前一致
  5. HTTP/MCP 入参 wire 名对齐 flag:path_style/page_size/start_after/next_token
    改为 kebab(path-style/page-size/start-after/next-token),与 CLI flag 完全同名;
    HTTP 响应字段保持原 snake_case 不变
  6. --json 全局化:stat/cat/presign/cp 现在也接受 --json/-j(xyz 全局 flag),
    但仅 ls/find 会切换 JSON 输出,其余命令输出不变

v0.2.0 — CLI migrated to xyz-go: one definition, three interfaces

Changes

  • The CLI frontend moved from urfave/cli to xyz-go v0.2.4: ls/stat/cat/presign/find
    now share ONE definition (one args struct + handler) with HTTP/MCP; cp/serve/mcp are
    CLI-only commands in the same registry; the urfave dependency is gone from go.mod
  • Custom middleware restores the previous CLI behavior: --color preference, -j/--json
    injection, streaming handlers skipping framework rendering, the "oss: " error prefix
  • Root help keeps its dns-style bilingual layout (the command table is now generated
    from the registry, so it can never drift); per-command -h: xyz template plus the
    bilingual prose and full examples (Description / CliHints.After blocks)
  • Shell completion from xyz-go v0.2.4 (oss completion bash|zsh|fish)

Unchanged (regression-verified item by item)

  • Every flag name/alias/shorthand/default of the six commands; ls PRE rows/colors/NDJSON/
    paging cache/footer hints, find's streaming hits/export/NDJSON summary, cp's progress
    bars and atomic writes, serve/mcp — all identical to v0.1.16

Known deviations (with reasons)

  1. find multi-positionals: oss find a b c errors with exit 2 — xyz positionals are
    fixed-count (no variadic). Use the first positional plus repeatable --inputs or stdin
    (single-input and stdin usage are unchanged)
  2. Usage errors exit 2 instead of 1: unknown flags / positional-count errors follow
    xyz semantics (2 = usage error; runtime errors still exit 1). Some framework messages
    (e.g. the positional-count error) are library-provided Chinese, not bilingual
  3. Help layout: per-command flag lists are rendered by xyz (with (default …)/alias
    hints, differing from urfave's style); bilingual examples live at the end of -h.
    -v/--version prints a single "oss version X" line (the repo URL is in oss -h)
  4. No comma splitting: --include a,b is one value now (xyz repeatable-flag
    semantics) — pass multiple values via repeated flags; HTTP/MCP behavior unchanged
  5. HTTP/MCP input wire names match flags: path_style/page_size/start_after/next_token
    are now kebab-case to equal the CLI flags exactly; HTTP response fields keep their
    snake_case names
  6. --json is global: stat/cat/presign/cp now accept --json/-j (xyz global flag), but
    only ls/find switch to JSON output; the others keep their usual output