git Windows 批处理文件中的 grep 和 xargs?
git grep and xargs in Windows Batch file?
我正在尝试为以下 .sh
脚本创建一个 Windows 友好的 .bat
实现。上面几行都可以,加SET
cd就可以了。 git grep 很好,但是,xargs
不是...... git grep | xargs
逻辑在 .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'
最近的 Git for Windows release 中打包了超过 200 个 Linux 命令。
添加到您的 PATH <path\to\Git\usr\bin
,您将拥有 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
我正在尝试为以下 .sh
脚本创建一个 Windows 友好的 .bat
实现。上面几行都可以,加SET
cd就可以了。 git grep 很好,但是,xargs
不是...... git grep | xargs
逻辑在 .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'
最近的 Git for Windows release 中打包了超过 200 个 Linux 命令。
添加到您的 PATH <path\to\Git\usr\bin
,您将拥有 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