Documentation
¶
Overview ¶
Package cli 是 CLI 组合根:它把命令树、执行生命周期与生产依赖装配 组装成一个可运行的 pixiv 命令(以及 MCP stdio/HTTP runtime)。
本文件持有命令树本身:app、命令树构建、常用 positional-args 与 prompt/flag 绑定等所有 command owner 共享的接线。
其余两个同包文件按职责拆分,便于在所属文件内理解一条完整流程:
- execution.go:执行入口、退出码、资源关闭、启动与结束处理;
- composition.go:Pixiv/FANBOX/MCP 的生产依赖装配。
Index ¶
- func Run(args []string, in io.Reader, out io.Writer, errOut io.Writer) int
- func RunContext(ctx context.Context, args []string, in io.Reader, out io.Writer, ...) int
- func RunContextWithBrokenPipeSignals(ctx context.Context, args []string, in io.Reader, out io.Writer, ...) int
- func RunContextWithDefaultBrokenPipeSignals(ctx context.Context, args []string, in io.Reader, out io.Writer, ...) int
- func RunContextWithPipelineSignal(ctx context.Context, args []string, in io.Reader, out io.Writer, ...) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunContext ¶ added in v0.2.0
func RunContext(ctx context.Context, args []string, in io.Reader, out io.Writer, errOut io.Writer) int
RunContext 让嵌入式调用方把取消信号传到每一条网络数据命令。
func RunContextWithBrokenPipeSignals ¶ added in v0.8.0
func RunContextWithBrokenPipeSignals(ctx context.Context, args []string, in io.Reader, out io.Writer, errOut io.Writer, enablePipelineSignal, enableMCPBrokenPipeSignal func() func()) int
RunContextWithBrokenPipeSignals 仅供二进制入口传入平台的 SIGPIPE 控制器。普通 NDJSON 输出和 MCP stdio 必须分别传入控制器:前者的 EPIPE 是下游正常停止,后者 则是 JSON-RPC transport 错误。
func RunContextWithDefaultBrokenPipeSignals ¶ added in v1.0.0
func RunContextWithDefaultBrokenPipeSignals(ctx context.Context, args []string, in io.Reader, out io.Writer, errOut io.Writer) int
RunContextWithDefaultBrokenPipeSignals 为二进制入口装配当前平台的默认 SIGPIPE 控制器:普通 NDJSON 输出与 MCP stdio 各自独立。嵌入式调用方若需要自定义信号 策略,应直接调用 RunContext 或 RunContextWithBrokenPipeSignals。
func RunContextWithPipelineSignal ¶ added in v0.8.0
func RunContextWithPipelineSignal(ctx context.Context, args []string, in io.Reader, out io.Writer, errOut io.Writer, enablePipelineSignal func() func()) int
RunContextWithPipelineSignal 仅由二进制入口传入 SIGPIPE 控制器。控制器会在 filter 或已解析的 --ndjson 查询命令运行期间启用,并在命令退出时恢复。
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package commands 提供所有 CLI command owner 共用的无状态生命周期声明。
|
Package commands 提供所有 CLI command owner 共用的无状态生命周期声明。 |
|
config
Package config 注册 config 命令。
|
Package config 注册 config 命令。 |
|
fanbox
Package fanbox 注册 FANBOX 命令组及其产品内 owner。
|
Package fanbox 注册 FANBOX 命令组及其产品内 owner。 |
|
fanbox/auth
Package auth owns local FANBOX authentication commands and secret prompts.
|
Package auth owns local FANBOX authentication commands and secret prompts. |
|
fanbox/download
Package download owns FANBOX post asset download commands.
|
Package download owns FANBOX post asset download commands. |
|
fanbox/internal/listing
Package listing owns the FANBOX shared paged-read execution and its bounded output commit semantics.
|
Package listing owns the FANBOX shared paged-read execution and its bounded output commit semantics. |
|
fanbox/post
Package post owns FANBOX content listing and post presentation commands.
|
Package post owns FANBOX content listing and post presentation commands. |
|
pixiv
Package deps defines the narrow common wiring used by Pixiv data commands.
|
Package deps defines the narrow common wiring used by Pixiv data commands. |
|
pixiv/auth
Package auth 注册 Pixiv auth 命令;具体 OAuth/login helper 也归本目录所有。
|
Package auth 注册 Pixiv auth 命令;具体 OAuth/login helper 也归本目录所有。 |
|
pixiv/bookmark
Package bookmark owns Pixiv bookmark reads and mutations.
|
Package bookmark owns Pixiv bookmark reads and mutations. |
|
pixiv/comment
Package comment owns the Pixiv comment listing command and its presenters.
|
Package comment owns the Pixiv comment listing command and its presenters. |
|
pixiv/detail
Package detail owns the Pixiv entity detail command and terminal presenter.
|
Package detail owns the Pixiv entity detail command and terminal presenter. |
|
pixiv/download
Package download owns the Pixiv download command and its terminal presenter.
|
Package download owns the Pixiv download command and its terminal presenter. |
|
pixiv/follow
Package follow owns Pixiv follow mutations.
|
Package follow owns Pixiv follow mutations. |
|
pixiv/internal/listing
Package listing owns Pixiv's shared paged-read execution and its bounded output commit semantics.
|
Package listing owns Pixiv's shared paged-read execution and its bounded output commit semantics. |
|
pixiv/mcp
Package mcp 注册 Pixiv MCP 命令。
|
Package mcp 注册 Pixiv MCP 命令。 |
|
pixiv/mypixiv
Package mypixiv owns the authenticated `pixiv mypixiv` command group.
|
Package mypixiv owns the authenticated `pixiv mypixiv` command group. |
|
pixiv/ranking
Package ranking owns the Pixiv artwork and novel ranking command.
|
Package ranking owns the Pixiv artwork and novel ranking command. |
|
pixiv/recommended
Package recommended owns personalized Pixiv recommendation output.
|
Package recommended owns personalized Pixiv recommendation output. |
|
pixiv/search
Package search owns the Pixiv artwork, novel and user search command routes.
|
Package search owns the Pixiv artwork, novel and user search command routes. |
|
pixiv/series
Package series owns the Pixiv artwork and novel series listing command.
|
Package series owns the Pixiv artwork and novel series listing command. |
|
pixiv/timeline
Package timeline owns the authenticated `pixiv timeline` command group.
|
Package timeline owns the authenticated `pixiv timeline` command group. |
|
pixiv/user
Package user owns the Pixiv user command group.
|
Package user owns the Pixiv user command group. |
|
update
Package update 注册 update 命令;更新实现仍归 internal/update。
|
Package update 注册 update 命令;更新实现仍归 internal/update。 |
|
Package diagnostics renders safe typed events for the CLI-owned stderr presenter.
|
Package diagnostics renders safe typed events for the CLI-owned stderr presenter. |
|
Package invocation 保存一次 CLI 调用的标准流。
|
Package invocation 保存一次 CLI 调用的标准流。 |
|
Package pipeline owns the CLI's explicit stdin input codecs and their resolved per-command state.
|
Package pipeline owns the CLI's explicit stdin input codecs and their resolved per-command state. |