From 2226256eedb2849f387ff566893a91bf5da3cdc9 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 15 Sep 2008 20:56:07 +0200 Subject: Noch ein paar Verbesserungen an den Ausgaben des CommandParsers --- src/Client/CommandParser.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/Client/CommandParser.cpp') diff --git a/src/Client/CommandParser.cpp b/src/Client/CommandParser.cpp index 9b5c009..b9368b5 100644 --- a/src/Client/CommandParser.cpp +++ b/src/Client/CommandParser.cpp @@ -55,7 +55,7 @@ void CommandParser::printUsage(const std::string& command) { const CommandParser::Command *cmd = findCommand(command); if(cmd) - std::cerr << "Usage: " << cmd->cmdline << std::endl; + std::cerr << "Usage: " << cmd->cmdline << std::endl << std::endl; } void CommandParser::printHostStatus(const Net::Packets::HostStatusPacket &packet) { @@ -129,10 +129,10 @@ void CommandParser::helpCommand(const std::vector &args) { if(command) { std::cout << "Usage: " << command->cmdline << std::endl << std::endl; - std::cout << command->longdesc << std::endl; + std::cout << command->longdesc << std::endl << std::endl; } else - std::cerr << args[0] << ": Command '" << args[1] << "' doesn't exist." << std::endl; + std::cerr << args[0] << ": Command '" << args[1] << "' doesn't exist." << std::endl << std::endl; } else { std::cerr << args[0] << ": Too many arguments." << std::endl; @@ -151,8 +151,11 @@ void CommandParser::statusCommand(const std::vector &args) { Requests::CoreStatusRequest::send(connection, sigc::mem_fun(this, &CommandParser::coreStatusRequestFinished)); else if(args.size() == 2) Requests::DaemonStatusRequest::send(connection, sigc::mem_fun(this, &CommandParser::daemonStatusRequestFinished), args[1]); - else + else { + std::cerr << args[0] << ": Too many arguments." << std::endl; + printUsage("status"); return; + } activeRequests++; } @@ -268,7 +271,7 @@ bool CommandParser::parse(const std::string &cmd) { if(command) (this->*command->funcPtr)(splitCmd); else - std::cerr << "Unknown command '" << splitCmd[0] << "'." << std::endl; + std::cerr << "Unknown command '" << splitCmd[0] << "'." << std::endl << std::endl; return true; } -- cgit v1.2.3