Author: jkupec Date: Thu Jan 31 13:17:51 2008 New Revision: 8419 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8419&view=rev Log: - fixed zypper help shell (bnc #357262) Modified: trunk/zypper/src/zypper.cc Modified: trunk/zypper/src/zypper.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/zypper/src/zypper.cc?rev=8419&r1=8418&r2=8419&view=diff ============================================================================== --- trunk/zypper/src/zypper.cc (original) +++ trunk/zypper/src/zypper.cc Thu Jan 31 13:17:51 2008 @@ -92,6 +92,12 @@ MIL << "Caught exit request:" << endl << e.msg() << endl; return exitCode(); } + + if (runningHelp()) + { + safeDoCommand(); + return exitCode(); + } switch(command().toEnum()) { @@ -101,12 +107,7 @@ return exitCode(); case ZypperCommand::NONE_e: - { - if (runningHelp()) - return ZYPPER_EXIT_OK; - else - return ZYPPER_EXIT_ERR_SYNTAX; - } + return ZYPPER_EXIT_ERR_SYNTAX; default: safeDoCommand(); @@ -410,6 +411,21 @@ setExitCode(ZYPPER_EXIT_ERR_SYNTAX); } } + else if (command() == ZypperCommand::SHELL && optind < _argc) + { + string arg = _argv[optind++]; + if (!arg.empty()) + { + if (arg == "-h" || arg == "--help") + setRunningHelp(true); + else + { + report_too_many_arguments("shell\n"); + setExitCode(ZYPPER_EXIT_ERR_INVALID_ARGS); + ZYPP_THROW(ExitRequestException("help provided")); + } + } + } // additional repositories if (gopts.count("plus-repo")) @@ -1225,6 +1241,23 @@ break; } + case ZypperCommand::SHELL_e: + { + static struct option quit_options[] = { + {"help", no_argument, 0, 'h'}, + {0, 0, 0, 0} + }; + specific_options = quit_options; + _command_help = _( + "shell\n" + "\n" + "Enter the zypper command shell.\n" + "\n" + "This command has no additional options.\n" + ); + break; + } + default: { ERR << "Unknown or unexpected command" << endl; @@ -2266,6 +2299,17 @@ return; } + else if (command() == ZypperCommand::SHELL) + { + if (!runningHelp()) + WAR << "this command should not be reached when not running help." + " Printing the help anyway." << endl; + + cout << _command_help; + + return; + } + // if the program reaches this line, something went wrong setExitCode(ZYPPER_EXIT_ERR_BUG); } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org