Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Git value parsers for Optique
Functions
Creates a set of git parsers with shared configuration.
Creates a value parser that validates local branch names.
Creates a value parser that validates commit SHAs.
Creates a value parser that validates any git reference.
Creates a value parser that validates remote names.
Creates a value parser that validates remote branch names.
Creates a value parser that validates tag names.
Interfaces
Custom error messages for git value parsers.
- invalidFormat: (input: string) => Message
Error message when the input format is invalid. Applies to parsers that validate format (e.g., commit SHA).
- listFailed: (dir: string) => Message
Error message when listing git references fails. This typically occurs when the directory is not a valid git repository.
- notFound: () => Messageinput: string,available?: readonly string[]
Error message when the git reference (branch, tag, remote, commit) is not found.
- remoteNotFound: () => Messageremote: string,availableRemotes: readonly string[]
Error message when the remote does not exist. Only used by gitRemoteBranch.
Options for creating git value parsers.
- dir: string
The directory of the git repository. Defaults to the current working directory.
- errors: GitParserErrors
Custom error messages for validation failures.
- metavar: NonEmptyString
The metavar name for this parser. Used in help messages to indicate what kind of value this parser expects.
- suggestionDepth: number
Maximum number of recent commits to include in shell completion suggestions. Only affects suggestions from
gitCommit()andgitRef()parsers, but is validated by all git parser functions. Must be a positive integer. Defaults to 15.
Git parsers factory interface.
- branch(options?: GitParserOptions): ValueParser<"async", string>
Creates a value parser that validates local branch names.
- commit(options?: GitParserOptions): ValueParser<"async", string>
Creates a value parser that validates commit SHAs.
- ref(options?: GitParserOptions): ValueParser<"async", string>
Creates a value parser that validates any git reference. Accepts branch names, tag names, or commit SHAs.
- remote(options?: GitParserOptions): ValueParser<"async", string>
Creates a value parser that validates remote names.
- remoteBranch(): ValueParser<"async", string>remote: string,options?: GitParserOptions
Creates a value parser that validates remote branch names.
- tag(options?: GitParserOptions): ValueParser<"async", string>
Creates a value parser that validates tag names.