summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Elliott Hughes <enh@google.com> 2020-06-10 09:51:57 -0700
committer Elliott Hughes <enh@google.com> 2020-06-10 09:51:57 -0700
commit0550c72cc921188b72c5ea8271dba23ec07279d3 (patch)
tree2c306a828a0b59a6b37725efcf707dee75bf580d
parent734f0a2fa11bf0c826216202a45aa1dda207f9d8 (diff)
bugreport/bugreportz: improve help/errors.
Fix bugreportz to report the usage error rather than ignore extra arguments. Also fix the synopsis in the usage text to include -p. Update the bugreport warnings to have the correct way to use bugreportz, since we now know it doesn't actually take a filename and instead chooses its own. Bug: http://b/156667896 Bug: http://b/29448020 Test: adb shell bugreport Test: adb shell bugreport --help Test: adb shell bugreportz Test: adb shell bugreportz file.zip Change-Id: I10875067cf49a1d9869a4cb7a4051c309eed6b17
-rw-r--r--cmds/bugreport/bugreport.cpp3
-rw-r--r--cmds/bugreportz/main.cpp8
2 files changed, 9 insertions, 2 deletions
diff --git a/cmds/bugreport/bugreport.cpp b/cmds/bugreport/bugreport.cpp
index 258b36721b..e5c52d8dff 100644
--- a/cmds/bugreport/bugreport.cpp
+++ b/cmds/bugreport/bugreport.cpp
@@ -32,7 +32,8 @@ int main(int argc, char* /*argv*/[]) {
fprintf(stderr, "WARNING: Flat (text file, non-zipped) bugreports are deprecated.\n");
fprintf(stderr, "WARNING: Please generate zipped bugreports instead.\n");
fprintf(stderr, "WARNING: On the host use: adb bugreport filename.zip\n");
- fprintf(stderr, "WARNING: On the device use: bugreportz filename.zip\n");
+ fprintf(stderr, "WARNING: On the device use: bugreportz\n");
+ fprintf(stderr, "WARNING: bugreportz will output the filename to use with adb pull.\n");
fprintf(stderr, "=============================================================================\n\n\n");
if (argc != 1) {
diff --git a/cmds/bugreportz/main.cpp b/cmds/bugreportz/main.cpp
index 40346bee1f..1d48e08f3e 100644
--- a/cmds/bugreportz/main.cpp
+++ b/cmds/bugreportz/main.cpp
@@ -30,7 +30,7 @@ static constexpr char VERSION[] = "1.1";
static void show_usage() {
fprintf(stderr,
- "usage: bugreportz [-h | -v]\n"
+ "usage: bugreportz [-hpv]\n"
" -h: to display this help message\n"
" -p: display progress\n"
" -v: to display the version\n"
@@ -64,6 +64,12 @@ int main(int argc, char* argv[]) {
}
}
+ // We don't support any non-option arguments.
+ if (optind != argc) {
+ show_usage();
+ return EXIT_FAILURE;
+ }
+
// TODO: code below was copy-and-pasted from bugreport.cpp (except by the
// timeout value);
// should be reused instead.