how to pass command line vairable to nps?

497 Views Asked by At

How can I pass parameter from command line to nps script that is called other nps script? I know I can pass parameter to nps script by nps "script arg" but I would like to execute command line like ./pnpm start test.unit file_path to actually execute ./node_modules/xxx/bin/xxx run --spec file_path

So far, if I set up package.json as following I can get what I want by ./pnpm run test file_path == xxx run --spec file_path

#package.json
  "scripts": {
    "start": "nps",
    "test": "xxx run --spec"
  },
./pnpm run test file_path

Now I would like to set up nps but how can I make nps read parameter from command line? so when I call ./pnpm start test file_path it can execute xxx run --spec file

#package-scripts.yaml
test:
    default: nps test.unit #?
    unit: xxx run --spec '@?' #?

the closed PR i can find is https://github.com/sezna/nps/issues/133#issuecomment-301915698 but i still do not understand how to pass it

0

There are 0 best solutions below