Repository: mesos Updated Branches: refs/heads/master c51e9b86a -> 69d627e17
Don't print full usage for invocation errors. The current usage string for `mesos-master` comes in at 399 lines, and for `mesos-agent` at 685 lines. Printing such a wall of text will overflow almost any terminal window, making it necessary to scroll up to see the actual error when invoking mesos with an incorrect command line. Review: https://reviews.apache.org/r/63733/ Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/69d627e1 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/69d627e1 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/69d627e1 Branch: refs/heads/master Commit: 69d627e17d118f805a504c58899c7d070be60a69 Parents: c51e9b8 Author: Benno Evers <bev...@mesosphere.com> Authored: Wed Mar 28 17:52:08 2018 +0200 Committer: Till Toenshoff <toensh...@me.com> Committed: Thu Mar 29 15:25:55 2018 +0200 ---------------------------------------------------------------------- src/master/main.cpp | 19 ++++++++++--------- src/slave/main.cpp | 21 +++++++++++---------- 2 files changed, 21 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/69d627e1/src/master/main.cpp ---------------------------------------------------------------------- diff --git a/src/master/main.cpp b/src/master/main.cpp index 3d93fd4..3def0f2 100644 --- a/src/master/main.cpp +++ b/src/master/main.cpp @@ -172,7 +172,8 @@ int main(int argc, char** argv) } if (load.isError()) { - cerr << flags.usage(load.error()) << endl; + cerr << load.error() << "\n\n" + << "See `mesos-master --help` for a list of supported flags." << endl; return EXIT_FAILURE; } @@ -194,8 +195,8 @@ int main(int argc, char** argv) } if (flags.ip_discovery_command.isSome() && flags.ip.isSome()) { - EXIT(EXIT_FAILURE) << flags.usage( - "Only one of `--ip` or `--ip_discovery_command` should be specified"); + EXIT(EXIT_FAILURE) + << "Only one of `--ip` or `--ip_discovery_command` should be specified"; } if (flags.ip_discovery_command.isSome()) { @@ -229,15 +230,15 @@ int main(int argc, char** argv) if (flags.zk.isNone()) { if (flags.master_contender.isSome() ^ flags.master_detector.isSome()) { EXIT(EXIT_FAILURE) - << flags.usage("Both --master_contender and --master_detector should " - "be specified or omitted."); + << "Both --master_contender and --master_detector should " + "be specified or omitted."; } } else { if (flags.master_contender.isSome() || flags.master_detector.isSome()) { EXIT(EXIT_FAILURE) - << flags.usage("Only one of --zk or the " - "--master_contender/--master_detector " - "pair should be specified."); + << "Only one of --zk or the " + "--master_contender/--master_detector " + "pair should be specified."; } } @@ -289,7 +290,7 @@ int main(int argc, char** argv) // Initialize modules. if (flags.modules.isSome() && flags.modulesDir.isSome()) { EXIT(EXIT_FAILURE) << - flags.usage("Only one of --modules or --modules_dir should be specified"); + "Only one of --modules or --modules_dir should be specified"; } if (flags.modulesDir.isSome()) { http://git-wip-us.apache.org/repos/asf/mesos/blob/69d627e1/src/slave/main.cpp ---------------------------------------------------------------------- diff --git a/src/slave/main.cpp b/src/slave/main.cpp index 6743727..dcc9448 100644 --- a/src/slave/main.cpp +++ b/src/slave/main.cpp @@ -276,7 +276,8 @@ int main(int argc, char** argv) } if (load.isError()) { - cerr << flags.usage(load.error()) << endl; + cerr << load.error() << "\n\n" + << "See `mesos-agent --help` for a list of supported flags." << endl; return EXIT_FAILURE; } @@ -298,24 +299,24 @@ int main(int argc, char** argv) } if (flags.master.isNone() && flags.master_detector.isNone()) { - EXIT(EXIT_FAILURE) << flags.usage( - "Missing required option `--master` or `--master_detector`"); + EXIT(EXIT_FAILURE) + << "Missing required option `--master` or `--master_detector`"; } if (flags.master.isSome() && flags.master_detector.isSome()) { - EXIT(EXIT_FAILURE) << flags.usage( - "Only one of `--master` or `--master_detector` should be specified"); + EXIT(EXIT_FAILURE) + << "Only one of `--master` or `--master_detector` should be specified"; } // Initialize libprocess. if (flags.ip_discovery_command.isSome() && flags.ip.isSome()) { - EXIT(EXIT_FAILURE) << flags.usage( - "Only one of `--ip` or `--ip_discovery_command` should be specified"); + EXIT(EXIT_FAILURE) + << "Only one of `--ip` or `--ip_discovery_command` should be specified"; } if (flags.ip6_discovery_command.isSome() && flags.ip6.isSome()) { - EXIT(EXIT_FAILURE) << flags.usage( - "Only one of `--ip6` or `--ip6_discovery_command` should be specified"); + EXIT(EXIT_FAILURE) + << "Only one of `--ip6` or `--ip6_discovery_command` should be specified"; } if (flags.ip_discovery_command.isSome()) { @@ -422,7 +423,7 @@ int main(int argc, char** argv) // Initialize modules. if (flags.modules.isSome() && flags.modulesDir.isSome()) { EXIT(EXIT_FAILURE) << - flags.usage("Only one of --modules or --modules_dir should be specified"); + "Only one of --modules or --modules_dir should be specified"; } if (flags.modulesDir.isSome()) {