Settings gSettings;
parsed_opts gopts; // global options
parsed_opts copts; // command options
+ZypperCommand command(ZypperCommand::NONE);
ostream no_stream(NULL);
* \returns ZypperCommand object representing the command or ZypperCommand::NONE
* if an unknown command has been given.
*/
-ZypperCommand process_globals(int argc, char **argv)
+void process_globals(int argc, char **argv)
{
static struct option global_options[] = {
{"help", no_argument, 0, 'h'},
// parse global options
gopts = parse_options (argc, argv, global_options);
if (gopts.count("_unknown"))
- return ZypperCommand::NONE;
+ return;
static string help_global_options = _(" Options:\n"
"\t--help, -h\t\tHelp.\n"
// get command
- ZypperCommand command(ZypperCommand::NONE_e);
try
{
if (optind < argc)
else
cerr << _("Try -h for help.") << endl;
}
-
- //cerr_vv << "COMMAND: " << command << endl;
- return command;
}
/// process one command from the OS shell or the zypper shell
-int one_command(const ZypperCommand & command, int argc, char **argv)
+int one_command(int argc, char **argv)
{
// === command-specific options ===
/// process one command from the OS shell or the zypper shell
// catch unexpected exceptions and tell the user to report a bug (#224216)
-int safe_one_command(const ZypperCommand & command, int argc, char **argv)
+int safe_one_command(int argc, char **argv)
{
int ret = ZYPPER_EXIT_ERR_BUG;
try {
- ret = one_command (command, argc, argv);
+ ret = one_command (argc, argv);
+ command = ZypperCommand::NONE;
}
catch (const Exception & ex) {
ZYPP_CAUGHT(ex);
else if (command == ZypperCommand::SHELL)
cout << _("You already are running zypper's shell.") << endl;
else
- safe_one_command (command, sh_argc, sh_argv);
+ safe_one_command (sh_argc, sh_argv);
}
catch (Exception & e)
{
MIL << "Hi, me zypper " VERSION " built " << __DATE__ << " " << __TIME__ << endl;
// parse global options and the command
- ZypperCommand command = process_globals (argc, argv);
+ process_globals (argc, argv);
switch(command.toEnum())
{
case ZypperCommand::SHELL_e:
return ZYPPER_EXIT_ERR_SYNTAX;
default:
- return safe_one_command(command, argc, argv);
+ return safe_one_command(argc, argv);
}
cerr_v << "This line should never be reached." << endl;
#include <zypp/CapFactory.h>
#include <zypp/RepoInfo.h>
+#include "zypper-command.h"
#define ZYPP_CHECKPATCHES_LOG "/var/log/zypper.log"
#undef ZYPP_BASE_LOGGER_LOGGROUP
extern RuntimeData gData;
extern Settings gSettings;
extern std::ostream no_stream;
+extern ZypperCommand command;
#define VERBOSITY_NORMAL 0
#define VERBOSITY_MEDIUM 1