Skip to content

Commit 2853e10

Browse files
authored
feat: support stop dot at the end (#36)
Sometimes you want to match a script with one word, but there are multiple two and three word scripts matching the prefix. ```json { "scripts": { "cypress": "cypress -help", "cypress:open": "cypress open", "cypress:run": "cypress run", "cypress:run:record": "cypress run --record" } } ``` In order to run "cypress" script use prefix with "." at the end: ``` # same as "npm run cypress" $ nr c. # only finds single word starting with "c" # same as "npm run cypress:open" $ nr c-o. # same as "npm run cypress:run" $ nr c-r. ```
1 parent 525f601 commit 2853e10

4 files changed

Lines changed: 41 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ jobs:
2323
# use prefix search by word
2424
node bin/npm-quick-run.js t-f 'foo bar'
2525
node bin/npm-quick-run.js t:f 'foo bar'
26+
# with stopper . at the end
27+
# https://github.com/bahmutov/npm-quick-run/issues/35
28+
node bin/npm-quick-run.js t-f. 'foo bar'
29+
# should find single "size" script
30+
node bin/npm-quick-run.js s.
2631
2732
- name: Semantic Release 🚀
2833
uses: cycjimmy/semantic-release-action@v2

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Install as a global tool `npm install -g npm-quick-run`. This creates two aliase
1818
$ nr t # runs script starting with "t"
1919
$ nr m -w # runs a script starting with "m", probably "npm run mocha -- -w"
2020
$ nr -i # runs npm-quick-run in interactive mode
21+
$ nr c-r # find script that has two+ words
22+
# first starts with "c", second with "r"
23+
$ nr c-r. # find script with exactly two words
24+
# first starts with "c", second with "r"
2125

2226
## Demo
2327

@@ -82,6 +86,34 @@ nr c-r-r
8286
# executes "cypress:run:record"
8387
```
8488

89+
### Separate words with count
90+
91+
Sometimes you want to match a script with one word, but there are multiple two and three word scripts matching the prefix.
92+
93+
```json
94+
{
95+
"scripts": {
96+
"cypress": "cypress -help",
97+
"cypress:open": "cypress open",
98+
"cypress:run": "cypress run",
99+
"cypress:run:record": "cypress run --record"
100+
}
101+
}
102+
```
103+
104+
In order to run "cypress" script use prefix with "." at the end:
105+
106+
```
107+
# same as "npm run cypress"
108+
$ nr c. # only finds single word starting with "c"
109+
110+
# same as "npm run cypress:open"
111+
$ nr c-o.
112+
113+
# same as "npm run cypress:run"
114+
$ nr c-r.
115+
```
116+
85117
## Extra arguments
86118

87119
You can pass extra arguments right after the prefix string

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"fuzzy": "0.1.3",
5757
"inquirer": "3.0.5",
5858
"inquirer-autocomplete-prompt": "0.8.0",
59-
"json-package": "1.2.2",
59+
"json-package": "1.3.0",
6060
"simple-bin-help": "1.7.0"
6161
},
6262
"devDependencies": {

0 commit comments

Comments
 (0)