Help us shape the future of Go! Take the 2026 Go Developer Survey

parse

package
v0.1.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitWithDash

func SplitWithDash(args []string, dashIndex int) (patterns, command []string)

SplitWithDash splits args into patterns (before dash) and command/flags (after dash). If dashIndex >= 0 (provided by Cobra ArgsLenAtDash), it splits at that index. Otherwise, it falls back to looking for a literal "--" element in args.

Types

type DiffArgs

type DiffArgs struct {
	Patterns    []string // repository filter regexps; empty means all
	DiffFlags   []string // optional arguments forwarded to "git diff"
	Interactive bool     // whether to run git diff interactively (with pager)
}

DiffArgs is the parsed argument set for the "diff" subcommand.

func ParseDiffArgs

func ParseDiffArgs(args []string) DiffArgs

ParseDiffArgs parses raw cobra args into DiffArgs.

func ParseDiffArgsWithDash

func ParseDiffArgsWithDash(args []string, dashIndex int) DiffArgs

ParseDiffArgsWithDash parses args taking into account Cobra's ArgsLenAtDash().

type DoArgs

type DoArgs struct {
	Patterns []string // repository filter regexps
	Command  []string // command to run in each matching repo
}

DoArgs is the parsed argument set for the "do" subcommand.

func ParseDoArgs

func ParseDoArgs(args []string) (DoArgs, error)

ParseDoArgs parses raw cobra args into DoArgs. Returns an error when no COMMAND is provided after "--".

func ParseDoArgsWithDash

func ParseDoArgsWithDash(args []string, dashIndex int) (DoArgs, error)

ParseDoArgsWithDash parses args taking into account Cobra's ArgsLenAtDash().

type FetchArgs

type FetchArgs struct {
	Patterns   []string // repository filter regexps; empty means all
	FetchFlags []string // optional arguments forwarded to "git fetch"
}

FetchArgs is the parsed argument set for the "fetch" subcommand.

func ParseFetchArgs

func ParseFetchArgs(args []string) FetchArgs

ParseFetchArgs parses raw cobra args into FetchArgs.

func ParseFetchArgsWithDash

func ParseFetchArgsWithDash(args []string, dashIndex int) FetchArgs

ParseFetchArgsWithDash parses args taking into account Cobra's ArgsLenAtDash().

type GrepArgs

type GrepArgs struct {
	Patterns    []string // repository filter regexps
	GitGrepArgs []string // arguments forwarded verbatim to "git grep"
}

GrepArgs is the parsed argument set for the "grep" subcommand.

func ParseGrepArgs

func ParseGrepArgs(args []string) (GrepArgs, error)

ParseGrepArgs parses raw cobra args into GrepArgs. Returns an error when no GIT_GREP_ARGS are provided after "--".

func ParseGrepArgsWithDash

func ParseGrepArgsWithDash(args []string, dashIndex int) (GrepArgs, error)

ParseGrepArgsWithDash parses args taking into account Cobra's ArgsLenAtDash().

type ListArgs

type ListArgs struct {
	Patterns []string // repository filter regexps; empty means all
}

ListArgs is the parsed argument set for the "list" subcommand.

func ParseListArgs

func ParseListArgs(args []string) ListArgs

ParseListArgs parses raw cobra args into ListArgs. Never errors.

type LsFilesArgs

type LsFilesArgs struct {
	Patterns     []string // repository filter regexps; empty means all
	LsFilesFlags []string // optional arguments forwarded to "git ls-files"
}

LsFilesArgs is the parsed argument set for the "ls-files" subcommand.

func ParseLsFilesArgs

func ParseLsFilesArgs(args []string) LsFilesArgs

ParseLsFilesArgs parses raw cobra args into LsFilesArgs.

func ParseLsFilesArgsWithDash

func ParseLsFilesArgsWithDash(args []string, dashIndex int) LsFilesArgs

ParseLsFilesArgsWithDash parses args taking into account Cobra's ArgsLenAtDash().

type PullArgs

type PullArgs struct {
	Patterns  []string // repository filter regexps; empty means all
	PullFlags []string // optional arguments forwarded to "git pull"
}

PullArgs is the parsed argument set for the "pull" subcommand.

func ParsePullArgs

func ParsePullArgs(args []string) PullArgs

ParsePullArgs parses raw cobra args into PullArgs.

func ParsePullArgsWithDash

func ParsePullArgsWithDash(args []string, dashIndex int) PullArgs

ParsePullArgsWithDash parses args taking into account Cobra's ArgsLenAtDash().

type ReadArgs

type ReadArgs struct {
	Command []string // command to run in each repo read from stdin
}

ReadArgs is the parsed argument set for the "read" subcommand.

func ParseReadArgs

func ParseReadArgs(args []string) ReadArgs

ParseReadArgs parses raw cobra args into ReadArgs. Never errors; cobra MinimumNArgs(1) ensures args is non-empty before RunE is called.

type StatusArgs

type StatusArgs struct {
	Patterns    []string // repository filter regexps; empty means all
	StatusFlags []string // optional arguments forwarded to "git status"
}

StatusArgs is the parsed argument set for the "status" subcommand.

func ParseStatusArgs

func ParseStatusArgs(args []string) StatusArgs

ParseStatusArgs parses raw cobra args into StatusArgs.

func ParseStatusArgsWithDash

func ParseStatusArgsWithDash(args []string, dashIndex int) StatusArgs

ParseStatusArgsWithDash parses args taking into account Cobra's ArgsLenAtDash().

Jump to

Keyboard shortcuts

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