#include #include #include #include "joblist.hpp" class shell { private: // the saga session we work in saga::session session_; // the directory we operate on std::string home_; saga::filesystem::directory cwd_; // the job management facility std::string contact_; std::string host_; saga::job::service js_; // map of active job pids to saga job ids joblist jobs_; // the commands // - namespace related void c_pwd (std::string = ""); void c_cd (std::string = ""); void c_ls (std::string = ""); void c_cp (std::string = ""); void c_mv (std::string = ""); void c_rm (std::string = ""); void c_ln (std::string = ""); void c_mkdir (std::string = ""); void c_rmdir (std::string = ""); // file related void c_cat (std::string = ""); // job related void c_run (std::string = ""); void c_run_fg (std::string = ""); void c_run_bg (std::string = ""); void c_ps (std::string = ""); void c_suspend (std::string = ""); void c_resume (std::string = ""); void c_kill (std::string = ""); void c_status (std::string = ""); void c_set (std::string = ""); void c_help (std::string = ""); // print shell prompt void prompt (std::string text = "", std::string marker = "# "); // print an error message void carp (std::string text = ""); // re-initialize some shell settings void init (void); // helper std::string state_to_string (saga::job::state state); public: // c'tor/d'tor shell (void); ~shell (void) { }; // the main event loop void run (void); };