Skip to main content
Deno 2 is finally here ๐ŸŽ‰๏ธ
Learn more
Module

x/dxx/src/lib/xArgs.ts>shellExpand

๐Ÿš€ (Deno) enhanced executor
Latest
function shellExpand
import { shellExpand } from "https://deno.land/x/dxx@rf/src/lib/xArgs.ts";

'shell'-expand argument string(s).

  • Performs bash-like expansion (compatible with the Bash v4.3 specification).
  • Quotes (single or double) are used to protect braces, tildes, and globs from expansion; unbalanced quotes are allowed (and parsed as if completed by the end of the string).
  • Character escape sequences are not recognized/supported.
  • Brace expansion is fully implemented (including nested braces and "brace bomb" protections).
  • Glob expansion supports globstar and full extended glob syntax.

Uses the braces* and picomatch JS modules.

Examples

Example 1

const expansion: string[] = await shellExpandAsync('{.,}'); // or `shellExpand(['{.,}*', './src/file_{1..10..2}_*.ts'])`

Parameters

args: string | string[]
optional
options: ArgsOptions = [UNSUPPORTED]