cmdx

package
v1.5.7 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapRunE

func WrapRunE(fn func(*Command, []string) error) func(*Command, []string) error

WrapRunE 包装 RunE:errx.Nil 哨兵错误视为无错误并返回 nil, 其余错误原样返回,避免占位错误被当作真实错误触发 cobra 的错误输出和用法提示。

Types

type Command

type Command = cobra.Command

Command 是 cobra.Command 的类型别名。

func NewRoot

func NewRoot(name string) *Command

NewRoot 创建带统一默认配置的根命令。 隐藏 help 和 completion 子命令,版本描述来自 osx.GetVersion 并以单行输出; 帮助与版本写入标准输出,cobra 自身的错误输出被丢弃, 命令错误仍由 Execute 返回,由调用方决定如何记录。

Jump to

Keyboard shortcuts

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