warpdotdev / warpdotdev/warp

Support ZSH Parameter | Wildcard Expansion

Open
#3,681 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement triaged
Dominant language
Rust
Stars
65.1k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

Discord username (optional)

No response

Describe the solution you'd like?
The `setopt GLOB_SUBST` command is used in the Zsh shell to enable the globbing feature for parameter expansion. 

Globbing is a feature that allows you to use wildcard patterns (also known as globs) to match filenames or other strings. When `GLOB_SUBST` is enabled, Zsh will perform globbing on the result of parameter expansion.

Here's an example to illustrate its usage:


setopt GLOB_SUBST

files=(file1.txt file2.txt file3.txt)

echo ${files[@]:s/.txt/.csv}


In this example, the `GLOB_SUBST` option is enabled, and the `${files[@]:s/.txt/.csv}` expression performs parameter expansion on the `files` array. The `s/.txt/.csv` part is a substitution pattern that replaces the `.txt` extension with `.csv` for each element in the array. With `GLOB_SUBST` enabled, Zsh will perform globbing on the result, so the output will be `file1.csv file2.csv file3.csv`.

Note that `setopt GLOB_SUBST` is specific to Zsh and may not be available in other shells like Bash or Fish.
Is your feature request related to a problem? Please describe.
`setopt GLOB_SUBST` in the `~/.zshrc` file doesn't work in Warp and produces an error message "warp_bootstrapped:10: bad pattern: [[" on every new session.
Additional context

Docs: https://zsh.sourceforge.io/Doc/Release/Expansion.html#Parameter-Expansion
Discord discussion: https://discord.com/channels/851854972600451112/1146858061294731304/1146876535123484723

How important is this feature to you?

3

Warp Internal (ignore) - linear-label:770f6576-d6c0-4e4f-a259-fc64b5156087

None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository files, tests, or entry points are named. Start by reviewing the linked Zsh parameter-expansion documentation and reproducing the command in Warp; done means setopt GLOB_SUBST no longer produces the reported bad-pattern error and wildcard expansion behaves as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
zsh
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.