Comparing version 4.0.2 to 4.0.3
{ | ||
"name": "run-pty", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"author": "Simon Lydell", | ||
@@ -31,11 +31,11 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/jest": "29.0.2", | ||
"@typescript-eslint/eslint-plugin": "5.37.0", | ||
"@typescript-eslint/parser": "5.37.0", | ||
"eslint": "8.23.1", | ||
"eslint-plugin-jest": "27.0.4", | ||
"jest": "29.0.3", | ||
"@types/jest": "29.2.0", | ||
"@typescript-eslint/eslint-plugin": "5.41.0", | ||
"@typescript-eslint/parser": "5.41.0", | ||
"eslint": "8.26.0", | ||
"eslint-plugin-jest": "27.1.3", | ||
"jest": "29.2.2", | ||
"jest-environment-node-single-context": "29.0.0", | ||
"prettier": "2.7.1", | ||
"typescript": "4.8.3" | ||
"typescript": "4.8.4" | ||
}, | ||
@@ -42,0 +42,0 @@ "scripts": { |
@@ -158,3 +158,3 @@ # run-pty | ||
- command: On the command line, you let your shell split the commands into arguments. In the JSON format, you need to do it yourself. For example, if you had `run-pty % npm run frontend` on the command line, the JSON version of it is `["npm", "run", "frontend"]`. And `run-pty % echo 'hello world'` would be `["echo", "hello world"]`. | ||
- command: On the command line, you let your shell split the commands into arguments. In the JSON format, you need to do it yourself. For example, if you had `run-pty % npm run frontend` on the command line, the JSON version of it is `["npm", "run", "frontend"]`. And `run-pty % echo 'hello world'` would be `["echo", "hello world"]`. See also: [Shell scripting](#shell-scripting). | ||
@@ -206,2 +206,14 @@ - title: If you have complicated commands, it might be hard to find what you’re looking for in the dashboard. This lets you use more human readable titles instead. The titles are also shown when you focus a command (before the command itself). | ||
## Shell scripting | ||
Let’s say you run `run-pty % npm run $command` on the command line. If the `command` variable is set to `frontend`, the command actually executed is `run-pty % npm run frontend` – run-pty receives `["%", "npm", "run", "frontend"]` as arguments (and has no idea that `frontend` came from a variable initially). This is all thanks to your shell – which is assumed to be a bash-like shell here; the syntax for Windows’ `cmd.exe` would be different, for example. | ||
If you try to put that in a [JSON file](#advanced-mode) as `"command": ["npm", "run", "$command"]`, run-pty is going to try to execute `npm` with the literal strings `run` and `$command`, so `npm` receives `["run", "$command"]` as arguments. There’s no shell in play here. | ||
Another example: Let’s say you wanted a command to first run `npm install` and then run `npm start` to start a server or something. If you run `run-pty % npm install && npm start` from the command line, it actually means “first run `run-pty % npm install` and once that’s done (and succeeded), run `npm start`”, which is not what you wanted. You might try to fix that by using escapes: `run-pty % npm install \&\& npm start`. However, run-pty is then going to execute `npm` with `["install", "&&", "npm", "start"]` as arguments. There’s no shell in play here either. | ||
run-pty only executes programs with an array of literal strings as arguments. | ||
If you want a shell, you could do something like this: `run-pty % bash -c 'npm install && npm start'` or `"command": ["bash", "-c", "npm run \"$command\""]`. You can also but that in a file, like `my-script.bash`, and use `run-pty % ./my-script.bash` or `"command": ["./my-script.bash"]`. If you need cross-platform support (or get tired of bash), you could instead use `run-pty % node my-script.js` or `"command": ["node", "my-script.js"]`. | ||
## Credits | ||
@@ -208,0 +220,0 @@ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82105
2142
244