具有多个参数的NPM调用bash脚本

时间:2018-11-25 11:48:47

标签: bash npm npm-scripts

我创建了一个bash脚本来自动执行git发布流程。该脚本采用一个或多个分支名称作为参数。

我可以在终端中使用以下命令调用脚本:Statement statement = select("*") .from(i(bucket.name())) .where(x("name").eq(s(name)) .and(x("ownerId").eq(s(ownerId))) .and(x("color").eq(s(color))) .and(x("_class").eq(s("com.example.Cat")))); CompletableFuture<Cat> completableFuture = new CompletableFuture(); bucket.async().query(statement) ...

但是我想将脚本与npm一起使用。我当前的package.json包含:

./releaseGit.sh -b branch1 -b branch2

但是使用这种配置,我只能将一个分支作为参数传递给脚本。我该如何更改?

有效:

"scripts": {
   (other scripts..)
   "git-release": "scripts/releaseGit.sh -b $*"
}

不起作用:

npm run git-release -b only-one-branch

0 个答案:

没有答案