Clarify documentation from `gclient recurse`
Applying a command on a value usually mean to call `cmd value`. Hence
it seemed important to me to clarify that the current working
directory is changed.
Tested:
* Entered `gclient recurse --help` and checked the new message appear.
* Entered both examples in the terminal and checked the output.
Thanks to sdefresne for his help understanding recurse.
Change-Id: I729efc2014ed3cf90112cc89875a283d58ce8af0
Fixed: 1345272
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3769966
Reviewed-by: Arthur Milchior <arthurmilchior@google.com>
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Arthur Milchior <arthurmilchior@google.com>
diff --git a/gclient.py b/gclient.py
index eab08d9..6a8f73b 100755
--- a/gclient.py
+++ b/gclient.py
@@ -2251,9 +2251,15 @@
def CMDrecurse(parser, args):
"""Operates [command args ...] on all the dependencies.
- Runs a shell command on all entries.
- Sets GCLIENT_DEP_PATH environment variable as the dep's relative location to
- root directory of the checkout.
+ Change directory to each dependency's directory, and call [command
+ args ...] there. Sets GCLIENT_DEP_PATH environment variable as the
+ dep's relative location to root directory of the checkout.
+
+ Examples:
+ * `gclient recurse --no-progress -j1 sh -c 'echo "$GCLIENT_DEP_PATH"'`
+ print the relative path of each dependency.
+ * `gclient recurse --no-progress -j1 sh -c "pwd"`
+ print the absolute path of each dependency.
"""
# Stop parsing at the first non-arg so that these go through to the command
parser.disable_interspersed_args()