Support glob patterns in the shell
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 8.1k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the user story
I'm a Yarn user and want to use glob patterns in my scripts. For example:
{
"scripts": {
"grep": "grep -F \"$1\" packages/*/sources"
}
}
Describe the solution you'd like
The shell should support a glob syntax (at least * and **).
Describe the drawbacks of your solution
Writing a good globing mechanism is difficult. The simplest would be to reuse an existing library such as glob, but I wonder how that would fit in the cross-platform story.
Describe alternatives you've considered
We simply could decide not to add support for glob patterns, and let users be more explicit when they wish to use them (grep -F \"$1\" $(bash -c 'echo packages/*/sources.js')). I guess them not being supported would be a surprise to most users, though.
Additional context
Ideally the syntax and the glob mechanism should be separate - the shell should expose a new glob option that would accept an async function that would return the match entries for a given argument and cwd, and default this option to whatever implementation we choose (likely the glob package). This way the shell consumers will be free to choose a different implementation if they want to, and it keeps the shell dependencies on the fs module low.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named in the issue. Start by locating the shell implementation and its consumers, then investigate how an async glob option could fit the cross-platform design. Done means supporting at least * and ** while allowing consumers to provide a different glob implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100