#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", 100, false) { } void ShowCommand::run(int argc, 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(101, "Befehl ist unbekannt."); } } // commands