Answer the question
In order to leave comments, you need to log in
How to forward arguments to the next pipe?
There is a program called like this:
```
cat some.js | eslint --stdin --stdin-filename=some.js
```
takes the contents of a file as input, and it also has a parameter that takes a filename. (--stdin-filename=some.js) is needed for correct output.
How do I forward an argument from one part (in this case, some.js) to the next part and substitute in the --stdin-filename parameter?
Answer the question
In order to leave comments, you need to log in
В данном конкретном случае можно вызвать просто: eslint yourfile.js
Пробросить аргумент, если я правильно понял, можно с помощью переменной:
file=some.js
eslint --stdin --stdin-filename="$file" < "$file"
myeslint() {
eslint --stdin --stdin-filename="$1" < "$1"
}
myeslint some.js
git diff --cached --name-only | xargs -I{} bash -c "cat {} | eslint --stdin --stdin-filename={}"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question