Update error messages in apply-include-cleaner
Improve the workflow for users that don't have a workdir named
out/Default by adding some hints to the error messages.
Bug: webrtc:15874
Change-Id: If214fee762b56cf4c82a72c8efb76626d0fbd238
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/389760
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#44512}
diff --git a/tools_webrtc/iwyu/apply-include-cleaner b/tools_webrtc/iwyu/apply-include-cleaner
index 02de99a..cec4dac 100755
--- a/tools_webrtc/iwyu/apply-include-cleaner
+++ b/tools_webrtc/iwyu/apply-include-cleaner
@@ -64,6 +64,7 @@
echo " -d <n> : Set debug level to <n>"
echo " -w : Specify the workdir (out/Default if not specified)"
echo " -h : Print this help message"
+ echo ""
}
COMMAND=" --edit"
@@ -93,11 +94,16 @@
fi
COMPILE_COMMANDS="$WORKDIR/compile_commands.json"
else
- error "Could not generate $WORKDIR/compile_commands.json."
+ usage
+ error "Could not generate $WORKDIR/compile_commands.json. Specify the workdir with -w if other than out/Default."
fi
fi
-# To get a list of files in a commit: git diff-tree --no-commit-id --name-only -r HEAD
+if [ $# -eq 0 ]; then
+ usage
+ error "No files provided as arguments. To get a list of files in a commit: git diff-tree --no-commit-id --name-only -r HEAD"
+fi
+
for FILE in "$@"
do
if [ -z $FILE ] || [ ! -f $FILE ]; then