Skip to content

feat: brace expansion ({a,b,c}, {1..5}, literal {})#178

Merged
bartlomieju merged 1 commit into
mainfrom
feat/brace-expansion
May 31, 2026
Merged

feat: brace expansion ({a,b,c}, {1..5}, literal {})#178
bartlomieju merged 1 commit into
mainfrom
feat/brace-expansion

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

The task shell parser used to reject any unquoted { or } with
"Unexpected character.", which meant common bash idioms like
find -exec {} \; and patterns like mocha test/{*,**/**}.js
couldn't run via deno task at all. This adds bash-style brace
expansion and makes braces literal when they don't form a valid
brace pattern.

Supported forms are comma alternatives {a,b,c}, integer ranges
{1..5} and {1..10..2}, single-character ranges {a..z},
nesting, and the cartesian product across multiple braces in one
word. Expansion happens before variable / tilde / command
substitution and globbing, matching bash. Braces inside single or
double quotes stay literal.

Fixes denoland/deno#20893
Fixes denoland/deno#24500

Implements bash-style brace expansion in the task shell parser and
evaluator, and stops rejecting unquoted `{` / `}` as "Unexpected
character." when they don't form a valid brace pattern.

This fixes denoland/deno#20893 (`echo {}` and `find -exec {} \;` now
work — bare `{}` and unmatched braces are literal) and
denoland/deno#24500 (patterns like `mocha test/{*,**/**}.js` expand
into multiple words before globbing).

Supported forms: comma alternatives `{a,b,c}`, integer ranges
`{1..5}` / `{1..10..2}`, single-character ranges `{a..z}`, nesting,
and cartesian product across multiple braces. Braces inside single
or double quotes remain literal, matching bash.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 29, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Member

@littledivy littledivy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bartlomieju bartlomieju merged commit 8c7a4bb into main May 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: deno task erroring on brace expansion Deno task doesn't accept {}

3 participants