#include "ShowCommand.h" #include "Error.h" #include "Util.h" #include "Manager.h" using util::Manager; using util::Util; using models::AddUser; using models::AddTask; using err::Error; namespace commands { ShowCommand::ShowCommand() : SubCommand("show", false) { } void ShowCommand::run(stringstream& args) { Manager& mgr = Manager::get_instance(); const string data_type = Util::read_string(args); if (data_type == "user") for (User* u : mgr.get_users()) { AddUser au = {*u}; cout << au; } else if (data_type == "task") for (Task* t : mgr.get_tasks()) { AddTask at = {*t}; cout << at; } else throw Error(102, "Ein Parameter eines Befehls konnte nicht gelesen werden"); } } // commands