> On March 28, 2014, 3:41 p.m., Adam B wrote: > > src/cli/mesos.cpp, lines 89-92 > > <https://reviews.apache.org/r/19180/diff/2/?file=519554#file519554line89> > > > > This code is the real problem. Don't recurse back into main or the > > paths will get doubly-added. There's actually nothing above here that we > > need to do again, so don't recurse at all. Drop line 92 "return main(argc, > > argv);" > > and to make it fall through, just change line 94 from > > "} else if (...) {" to > > "} > > if (...) {" > > Now "mesos help foo" will just turn into "mesos foo --help" and keep > > going. > > This solves everything except "mesos help help", which can be fixed by > > replacing line 85 "if (argc == 2) {" with "if (argc == 2 || string(argv[2]) > > == "help") {".
This is another alternative solution, not recurse anything but introduce a special case (argv[2] is "help"). I'd say there maybe the 3rd, 4th alternative solutions, I'm waiting for a committer to decide. I'm not going to waste time on creating several patches to fix such a small problem. - Chengwei ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/19180/#review38880 ----------------------------------------------------------- On March 26, 2014, 9:32 a.m., Chengwei Yang wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/19180/ > ----------------------------------------------------------- > > (Updated March 26, 2014, 9:32 a.m.) > > > Review request for mesos, Adam B, Ben Mahler, Niklas Nielsen, and Vinod Kone. > > > Bugs: MESOS-1093 > https://issues.apache.org/jira/browse/MESOS-1093 > > > Repository: mesos-git > > > Description > ------- > > cli: only add local bin direcotry to PATH at first through > > Without this patch, "mesos help --help" will output below > > Not expecting '--help' before command > Usage: mesos <command> [OPTIONS] > > Available commands: > help > resolve > cat > scp > log > tail > execute > ps > local > resolve > cat > scp > log > tail > execute > ps > local > > Apparently all available commands printed twice, the "mesos help help" > will print available commands 3 times. > > Review: https://reviews.apache.org/r/19180 > > > Diffs > ----- > > src/cli/mesos.cpp 171a707cd2ba2348898e7fbe8fe9f0634edd6d86 > > Diff: https://reviews.apache.org/r/19180/diff/ > > > Testing > ------- > > done? > > > Thanks, > > Chengwei Yang > >