diff options
-rw-r--r-- | src/Client/UserListCommands.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
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<std::string>::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<std::string>::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("<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<std::string>::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) { |