Skip to main content
Home

Built and signed on GitHub Actions

Process-integrated CLI parser for Node.js, Bun, and Deno

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 Score
100%
Published
2 weeks ago (0.6.2)
interface PathOptions

Configuration options for the path value parser.

Properties

readonly
optional
metavar: string

The metavariable name for this parser, e.g., "FILE", "DIR".

readonly
optional
mustExist: boolean

Whether the path must exist on the filesystem.

readonly
optional
type:
"file"
| "directory"
| "either"

Expected type of path (file, directory, or either). Only checked when mustExist is true.

readonly
optional
allowCreate: boolean

Whether to allow creating new files/directories. When true and mustExist is false, validates that parent directory exists.

readonly
optional
extensions: readonly string[]

File extensions to accept (for files only). Each extension must start with a dot (e.g. ".json", ".yaml").

readonly
optional
errors: { invalidExtension?: Message | ((
input: string,
extensions: readonly string[],
actualExtension: string,
) => Message)
; pathNotFound?: Message | ((input: string) => Message); notAFile?: Message | ((input: string) => Message); notADirectory?: Message | ((input: string) => Message); parentNotFound?: Message | ((parentDir: string) => Message); }

Custom error messages for path validation failures.

New Ticket: 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/run

Import symbol

import { type PathOptions } from "@optique/run";
or

Import directly with a jsr specifier

import { type PathOptions } from "jsr:@optique/run";

Add Package

pnpm i jsr:@optique/run
or (using pnpm 10.8 or older)
pnpm dlx jsr add @optique/run

Import symbol

import { type PathOptions } from "@optique/run";

Add Package

yarn add jsr:@optique/run
or (using Yarn 4.8 or older)
yarn dlx jsr add @optique/run

Import symbol

import { type PathOptions } from "@optique/run";

Add Package

vlt install jsr:@optique/run

Import symbol

import { type PathOptions } from "@optique/run";

Add Package

npx jsr add @optique/run

Import symbol

import { type PathOptions } from "@optique/run";

Add Package

bunx jsr add @optique/run

Import symbol

import { type PathOptions } from "@optique/run";