git grep and xargs in Windows Batch file?
11,212
Any recent Git for Windows release has more than 200 Linux commands packaged in it.
Add to your PATH <path\to\Git\usr\bin
and you will have xargs
.
vonc@VONCM D:\prgs\git\PortableGit-2.9.2-64-bit\usr\bin
> dir xargs.exe
Directory of D:\prgs\git\PortableGit-2.9.2-64-bit\usr\bin
20/01/2016 10:17 64 058 xargs.exe
Author by
George Edwards
Updated on June 14, 2022Comments
-
George Edwards almost 2 years
I am trying to create a Windows friendly
.bat
implementation of the following.sh
script. The top few lines are all fine, just addSET
and cd is fine. git grep is fine, however,xargs
isn't... What would thegit grep | xargs
logic look like in.bat
?INFINITY=10000 TOPDIR=$(pwd) METEOR_DIR="./code" cd "$METEOR_DIR" # Call git grep to find all js files with the appropriate comment tags, # and only then pass it to JSDoc which will parse the JS files. # This is a whole lot faster than calling JSDoc recursively. git grep -al "@summary" | xargs -L ${INFINITY} -t \ "$TOPDIR/node_modules/.bin/jsdoc" \ -t "$TOPDIR/jsdoc/docdata-jsdoc-template" \ -c "$TOPDIR/jsdoc/jsdoc-conf.json" \ 2>&1 | grep -v 'WARNING: JSDoc does not currently handle'
-
user2956477 over 6 yearsMented xargs port depend on some external libraries, try to use native xargs port pirosa.co.uk/demo/wxargs/wxargs.html instead
-
VonC over 6 years@user2956477 why? All external libraries are packages with Git for Windows.
-
user2956477 over 6 yearsIts always better to have single native binary without dependency, it minimize possible troubles
-
VonC over 6 years@user2956477 OK, makes sense. But in reality, I don't bother, because there are 200 Linux commands already working.