Skip to main content

Built and signed on GitHub Actions

Works with
This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score100%
License
MIT
Downloads14/wk
Published4 days ago (1.0.0)

Git value parsers for Optique

Functions

f
createGitParsers(options?: GitParserOptions): GitParsers

Creates a set of git parsers with shared configuration.

f
gitBranch(options?: GitParserOptions): ValueParser<"async", string>

Creates a value parser that validates local branch names.

f
gitCommit(options?: GitParserOptions): ValueParser<"async", string>

Creates a value parser that validates commit SHAs.

f
gitRef(options?: GitParserOptions): ValueParser<"async", string>

Creates a value parser that validates any git reference.

f
gitRemote(options?: GitParserOptions): ValueParser<"async", string>

Creates a value parser that validates remote names.

f
gitRemoteBranch(
remote: string,
options?: GitParserOptions
): ValueParser<"async", string>

Creates a value parser that validates remote branch names.

f
gitTag(options?: GitParserOptions): ValueParser<"async", string>

Creates a value parser that validates tag names.

Interfaces

I

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: (
    input: string,
    available?: readonly string[]
    ) => Message

    Error message when the git reference (branch, tag, remote, commit) is not found.

  • remoteNotFound: (
    remote: string,
    availableRemotes: readonly string[]
    ) => Message

    Error message when the remote does not exist. Only used by gitRemoteBranch.

I

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.

  • Maximum number of recent commits to include in shell completion suggestions. Only affects suggestions from gitCommit() and gitRef() parsers, but is validated by all git parser functions. Must be a positive integer. Defaults to 15.

I

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(
    remote: string,
    options?: GitParserOptions
    ): ValueParser<"async", string>

    Creates a value parser that validates remote branch names.

  • tag(options?: GitParserOptions): ValueParser<"async", string>

    Creates a value parser that validates tag names.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@optique/git

Import symbol

import * as mod from "@optique/git";
or

Import directly with a jsr specifier

import * as mod from "jsr:@optique/git";