feat: put/hash 支持 --pipe/-p 从 stdin 读取内容 #83

Closed
opened 2026-06-01 01:10:09 +00:00 by xingyue · 0 comments
Owner

What

puthash 命令目前只接受文件路径作为输入,不支持从 stdin 读取。增加 --pipe / -p flag 让它们能从管道读内容。

Why

当前如果想 put 一段 inline JSON,必须先写到临时文件再传路径,不方便。支持 stdin 后可以:

echo '{"name":"test"}' | json-cas put <type-hash> -p
echo '{"name":"test"}' | json-cas hash <type-hash> -p
cat data.json | json-cas put <type-hash> -p

render -p 保持一致的 flag 命名。

Scope

  • put--pipe / -p flag,从 stdin 读 JSON 并存入 CAS
  • hash--pipe / -p flag,从 stdin 读 JSON 并计算 hash(不存储)
  • -p 时第二个 positional arg(文件路径)不再 required
## What `put` 和 `hash` 命令目前只接受文件路径作为输入,不支持从 stdin 读取。增加 `--pipe` / `-p` flag 让它们能从管道读内容。 ## Why 当前如果想 put 一段 inline JSON,必须先写到临时文件再传路径,不方便。支持 stdin 后可以: ```bash echo '{"name":"test"}' | json-cas put <type-hash> -p echo '{"name":"test"}' | json-cas hash <type-hash> -p cat data.json | json-cas put <type-hash> -p ``` 与 `render -p` 保持一致的 flag 命名。 ## Scope - `put` 加 `--pipe` / `-p` flag,从 stdin 读 JSON 并存入 CAS - `hash` 加 `--pipe` / `-p` flag,从 stdin 读 JSON 并计算 hash(不存储) - 当 `-p` 时第二个 positional arg(文件路径)不再 required
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/json-cas#83