From 8c6ea75e487172e23822b39b6cf58fbc947971e4 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Thu, 24 Sep 2009 23:46:54 +0200 Subject: UserListCommands: Just some formatting changes --- src/Client/UserListCommands.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Client/UserListCommands.cpp b/src/Client/UserListCommands.cpp index 420202e..ad0c2d0 100644 --- a/src/Client/UserListCommands.cpp +++ b/src/Client/UserListCommands.cpp @@ -202,34 +202,45 @@ void UserListCommands::showListCommand(CommandParser *commandParser, const std:: } } + std::cout << " "; printPadded(USER_NAME, lengths.find(USER_NAME)->second); + std::cout << " "; printPadded(GROUP_NAME, lengths.find(GROUP_NAME)->second); for(std::set::iterator detail = details.begin(); detail != details.end(); ++detail) { + std::cout << " "; printPadded(*detail, lengths.find(*detail)->second); } std::cout << std::endl; + std::cout << "-"; printDelimiter(lengths.find(USER_NAME)->second); + std::cout << "- -"; printDelimiter(lengths.find(GROUP_NAME)->second); for(std::set::iterator detail = details.begin(); detail != details.end(); ++detail) { + std::cout << "- -"; printDelimiter(lengths.find(*detail)->second); } - std::cout << std::endl; + std::cout << "-" << std::endl; for(Common::UserLists::UserList::iterator user = userList->begin(); user != userList->end(); ++user) { static const std::string UNSET(""); + std::cout << " "; + if(!user->getName().empty()) printPadded(user->getName(), lengths.find(USER_NAME)->second); else printPadded(UNSET, lengths.find(USER_NAME)->second); + std::cout << " "; + if(!user->getGroup().empty()) printPadded(user->getGroup(), lengths.find(GROUP_NAME)->second); else printPadded(UNSET, lengths.find(GROUP_NAME)->second); for(std::set::iterator detail = details.begin(); detail != details.end(); ++detail) { + std::cout << " "; printPadded(user->getDetail(*detail), lengths.find(*detail)->second); } @@ -247,11 +258,9 @@ void UserListCommands::showListCommand(CommandParser *commandParser, const std:: } void UserListCommands::printPadded(const std::string &str, unsigned length) { - static const int EXTRA_PADDING = 3; - std::cout << str; - if(str.length() < length + EXTRA_PADDING) - std::cout << std::string(length-str.length()+EXTRA_PADDING, ' '); + if(str.length() < length) + std::cout << std::string(length-str.length(), ' '); } void UserListCommands::printDelimiter(unsigned length) { -- cgit v1.2.3