gitargv

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package gitargv parses Git's stable global argv and classifies invocations that cannot safely be buffered by sctx.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasFlag

func HasFlag(args []string, names ...string) bool

HasFlag reports whether a command-local option is present before --. Long equals forms and one-letter short clusters are recognized.

func HasOptionPrefix

func HasOptionPrefix(args []string, names ...string) bool

HasOptionPrefix reports options whose value may be attached with '='.

func SafeToBuffer

func SafeToBuffer(inv Invocation) bool

SafeToBuffer rejects commands that stream, run an interactive UI/editor, or wait for a protocol on stdin. All other Git commands are finite and may reach the formatter's structured/relaxed/verbatim tier chain.

Types

type Invocation

type Invocation struct {
	Command      string
	CommandIndex int
	Args         []string
}

Invocation identifies Git's command and the arguments after it.

func Parse

func Parse(argv []string) (Invocation, bool)

Parse locates Git's command after global options. Unknown global options decline instead of guessing whether their next token is a value.

Jump to

Keyboard shortcuts

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