cli

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 50 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cli 承载 wind 的子命令逻辑(执行计划 §6.9)。与 main 分离: IO(stdin/stdout/stderr)全部注入,命令函数返回退出码而非直接 os.Exit, 集成测试得以在进程内驱动完整 share/get 流程(DfT)。

Index

Constants

View Source
const (
	ExitOK      = 0
	ExitFailure = 1 // 运行期失败:传输中断、本地 IO、内部错误
	ExitUsage   = 2 // 用户错误:参数、链接/密钥、路径选择、清单超限
	ExitNetwork = 3 // 网络/中转不可达或被中转拒绝
	ExitDrift   = 4 // 快照漂移中止:分享期间文件被修改(§6.3)
)

退出码语义(§6.9 工程要求):脚本据此区分"该重试"(网络)与"该改命令" (用户错误)与"该重新分享"(漂移)。

Variables

This section is empty.

Functions

func Main

func Main() int

Main 是 os 进程入口的接线:真实标准流 + 终止信号取消(Ctrl-C、SIGTERM、 SIGHUP 都是"停止分享"/"中断下载"语义,§6.9)。

Types

type App

type App struct {
	Stdout io.Writer
	Stderr io.Writer
	Stdin  io.Reader
	// contains filtered or unexported fields
}

App 是一次 CLI 调用的执行环境;字段即全部外部依赖。

func (*App) Run

func (a *App) Run(ctx context.Context, args []string) (code int)

Run 分派子命令。stdlib flag 不认子命令,这里手工分派(§6.9 工程要求: 不引 CLI 框架)。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL