I have an xargs
function that calls git commands recursively.
When I now call gitr log
I have to hit enter until the end or q to get the next xargs
call to run.
Can I tell xargs
to skip user input or output everything of less
at once?
You can call git
with the --no-pager
option if you want it to dump out everything without running less
. Here are details from the man page:
--no-pager
Do not pipe git output into a pager.
It isn't xargs that's prompting you, it's less. And less isn't invoked by xargs, but by git.
Each invocation of git operates on one repository at a time, so if you want to operate on multiple repositories, you'll need to tell git not to invoke a pager. You may want to invoke a pager manually though.
Here's some untested proof-of-concept code that causes git not to invoke a pager, but invokes a pager on the output from all the git invocations when called interactively. Your code goes into the run_git
auxiliary function.
gitr () {
if [ -t 1 ]; then
run_git \
-ccolor.branch=always "$@" -ccolor.grep=always -ccolor.showbranch=always -ccolor.status=always \
| ${GIT_PAGER:-less -r}
else
run_git "$@"
fi
}
git
with the--no-pager
option if you want it to dump out everything without runningless
.