Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: add support for command with ':' #24

Closed
havenchyk opened this issue Jun 2, 2016 · 9 comments · Fixed by #34
Closed

Feature request: add support for command with ':' #24

havenchyk opened this issue Jun 2, 2016 · 9 comments · Fixed by #34

Comments

@havenchyk
Copy link

Hi, @bahmutov, thanks for you amazing work!

I frequently use scripts like "watch:test": "npm run test -- --watch", that contain : in the name.
So the idea to support nr w:t

What do you think? I guess it can be done as an extension of json-package, isn't it?

@bahmutov
Copy link
Owner

bahmutov commented Jun 2, 2016

interesting idea, I don't use the ":" in my script names, but definitely see the value in your case. Have you looked at the code for finding scripts in json-package? If you can implement it (with tests) in json-package, I promise to quickly merge it and bump npm-quick-run to have this.

@havenchyk
Copy link
Author

thanks for a quick response! I've looked through the method, actually I'll try to find time to implement it with tests.

@kentcdodds
Copy link
Contributor

I also would love this 😄

Maybe someday I'll find time to work on it 🙃

@kentcdodds
Copy link
Contributor

Actually, I think what would be best is if the scripts were sorted via match-sorter. Would you be willing to accept a PR that does that?

@bahmutov
Copy link
Owner

bahmutov commented Sep 5, 2017

Of course @kentcdodds - everything will be merged quickly :)

@lordlycastle
Copy link

lordlycastle commented Jul 28, 2020

...merged quickly

So life took over.... happens to all the adults. Was this ready or started? I would take it over.

And I also want to add fuzzy search since prefix isn't good enough for us as we have variations using : command, command-fix, command-framework, command:beta, etc. What do you think @bahmutov #32

@bahmutov
Copy link
Owner

Well, I am on board, but no one has opened a pull request, so ...

bahmutov added a commit that referenced this issue Mar 10, 2021
bahmutov added a commit that referenced this issue Mar 10, 2021
bahmutov added a commit that referenced this issue Mar 10, 2021
If your scripts have separate words, you can specify prefixes for each one. For example, the `package.json` file below has 3 scripts

```json
{
  "scripts": {
    "cypress:open": "cypress open",
    "cypress:run": "cypress run",
    "cypress:run:record": "cypress run --record"
  }
}
```

You can quickly open Cypress using

```
nr c:o
# same as
nr c-o
# same as
nr cy-open
```

Characters `:` and `-` are interchangeable and can be used in the prefix or in the script names.

In the above situation

```
nr c-r
# returns both "cypress:run" and "cypress:run:record"
nr c-r-r
# executes "cypress:run:record"
```
@github-actions
Copy link

🎉 This issue has been resolved in version 1.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sinnbeck
Copy link

Shouldnt this fix just run if there is an exact match? Currently it does not

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants