diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-09-15 20:56:07 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-09-15 20:56:07 +0200 |
commit | 2226256eedb2849f387ff566893a91bf5da3cdc9 (patch) | |
tree | 3f4358dfe7288535e9cae47df19f5fadac9c3575 /src/Client | |
parent | cad5339477f7c9897745d87b0ef21a08aba2933a (diff) | |
download | mad-2226256eedb2849f387ff566893a91bf5da3cdc9.tar mad-2226256eedb2849f387ff566893a91bf5da3cdc9.zip |
Noch ein paar Verbesserungen an den Ausgaben des CommandParsers
Diffstat (limited to 'src/Client')
-rw-r--r-- | src/Client/CommandParser.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
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<std::string> &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<std::string> &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; } |