diff --git a/src/main.cpp b/src/main.cpp index 60303ca..93a198d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,6 +30,7 @@ void print_help() { std::cout << std::endl; std::cout << "Service commands: (if no service is specified, all services for the server are affected)" << std::endl; std::cout << " install SERVER [SERVICE] Install/reinstall/update service(s). Non-destructive." << std::endl; + std::cout << " view [SERVER] [SERVICE] View status/details of all servers/server/service." << std::endl; std::cout << " edit [SERVER] [SERVICE] Edit the configuration of dropshell/server/service." << std::endl; std::cout << " COMMAND SERVER [SERVICE] Run a command on service(s)." << std::endl; std::cout << std::endl; @@ -73,9 +74,7 @@ int main(int argc, char* argv[]) { cfg->load_config(); if (argc == 1) { - dropshell::list_servers(); - std::cout << std::endl; - std::cout << "dropshell help - get help on using dropshell" << std::endl; + dropshell::print_help(); return 0; } std::string cmd = argv[1]; @@ -132,7 +131,8 @@ int main(int argc, char* argv[]) { }); if (cfg->is_config_set()) full_command_set.merge(std::set{ - "server","templates","create-service","create-template","create-server","edit","ssh" // only if we have a config. + "server","templates","create-service","create-template","create-server","edit","ssh", + "view" // only if we have a config. }); for (const auto& command : full_command_set) { @@ -196,16 +196,22 @@ int main(int argc, char* argv[]) { return 0; } - if (cmd == "server") { - if (argc > 2) { - // Show details for specific server - dropshell::show_server_details(argv[2]); - } else { - // List all servers - dropshell::list_servers(); + if (cmd == "server" || cmd == "servers" || cmd == "view" || cmd == "views" || cmd == "v") + switch (argc) + { + case 2: + dropshell::list_servers(); + return 0; + case 3: + dropshell::show_server_details(argv[2]); + return 0; + case 4: + cmd="logs"; + break; + default: + std::cerr << "dropshell server: too many arguments" << std::endl; + return 1; } - return 0; - } if (cmd == "templates") { dropshell::list_templates();