#include #include #include #include "joblist.hpp" class shell { private: // the shell we are working in saga::session session_; // the directory we operate on std::string home_; saga::name_space::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_touch (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 = ""); // logical_file related void c_log_find (std::string = ""); void c_log_list (std::string = ""); void c_log_add (std::string = ""); void c_log_remove (std::string = ""); void c_log_update (std::string = ""); void c_log_replicate (std::string = ""); // job related void c_run (std::string = ""); void c_run2 (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 = "", bool is_error = true); // re-initialize some shell settings void init (void); // helper std::string state_to_string (saga::job::state state); void usleep (long int usec); public: // c'tor/d'tor shell (void); ~shell (void) { }; // the main event loop void run (void); };