cli

package
v0.24.9 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package cli is the shared flaggy wrapper (D23).

flaggy: zero deps, flags at any position, shell completion scripts. Individual tools keep ShowCompletion off so a query like "completion" is not stolen; dump scripts with bin/shell/complete.go.

Index

Constants

View Source
const ExitSkip = 3

ExitSkip is the exit code a tool returns when its work is deliberately not run — credentials or a source session are missing (e.g. chats without TELEGRAM_* / LINKEDIN_* config). The stack wave prints SKIP for it and does not count it as a failure.

Variables

View Source
var ErrHelp = errors.New("help")

ErrHelp means -h/--help was requested (exit 0).

Functions

func BashScript

func BashScript(tools []Tool) string

BashScript concatenates flaggy bash complete scripts and binds each function to the shebang path (./bin/subject/method.go).

func BindQA

func BindQA(c *QAStats) *flaggy.Parser

func Code

func Code(err error) int

Code maps parse errors to process exit codes (0 help, 2 usage).

func Fail

func Fail(err error) int

Fail prints err unless it is help or a flaggy exit that already wrote stderr.

func New

func New(name string) *flaggy.Parser

New returns a per-call parser. Never reuse: flaggy parses once.

func Parse

func Parse(p *flaggy.Parser, args []string) error

Parse runs p.ParseArgs and turns flaggy's os.Exit into an error. Not safe to call in parallel (flaggy.PanicInsteadOfExit is process-global).

func QAParser

func QAParser() *flaggy.Parser

func Query

func Query(first string, trailing []string) string

Query joins the first positional with leftover trailing words.

Types

type QAStats

type QAStats struct {
	JSONL string
}

func ParseQAStats

func ParseQAStats(args []string) (QAStats, error)

type Tool

type Tool struct {
	Path string
	Name string
	New  func() *flaggy.Parser
}

Tool is one shebang CLI for completion dump.

Jump to

Keyboard shortcuts

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