akoenig / npm-run.plugin.zsh

Autocompletion support for `npm run`.
54 stars 7 forks source link

Scripts with a `:` #3

Open mxstbr opened 8 years ago

mxstbr commented 8 years ago

I have a few linting script for my react-boilerplate, structured like this:

"scripts": {
    "lint": "npm run lint:js && npm run lint:css",
    "lint:js": "eslint .",
    "lint:js:staged": "eslint-staged",
    "lint:css": "stylelint ./app/**/*.css",
    "lint:css:staged": "stylelint-staged",
    "lint:staged": "npm run lint:js:staged && npm run lint:css:staged"
}

When using this (otherwise amazing) plugin, I get the following instead:

screen shot 2016-02-18 at 14 21 20

Which doesn't work because the : are stripped. Any ideas why this happens and how to fix it?

Thanks for this great plugin!

denysdovhan commented 8 years ago

The same problem.

chrisbward commented 7 years ago

same issue here - does not like :targets

igorprado commented 6 years ago

Submitted a PR that fixes this issue for me:

https://github.com/akoenig/npm-run.plugin.zsh/pull/8/files

bschlenk commented 4 years ago

If you don't mind a dependency on jq, you can change line 11 to this which feels a lot more robust:

compls=$([[ -s $PWD/package.json ]] || return 0 && jq -r '.scripts | keys | sort | .[]' package.json)