View command added.
This commit is contained in:
parent
8e0683c997
commit
6251849923
32
src/main.cpp
32
src/main.cpp
@ -30,6 +30,7 @@ void print_help() {
|
|||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
std::cout << "Service commands: (if no service is specified, all services for the server are affected)" << 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 << " 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 << " 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 << " COMMAND SERVER [SERVICE] Run a command on service(s)." << std::endl;
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
@ -73,9 +74,7 @@ int main(int argc, char* argv[]) {
|
|||||||
cfg->load_config();
|
cfg->load_config();
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
dropshell::list_servers();
|
dropshell::print_help();
|
||||||
std::cout << std::endl;
|
|
||||||
std::cout << "dropshell help - get help on using dropshell" << std::endl;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
std::string cmd = argv[1];
|
std::string cmd = argv[1];
|
||||||
@ -132,7 +131,8 @@ int main(int argc, char* argv[]) {
|
|||||||
});
|
});
|
||||||
if (cfg->is_config_set())
|
if (cfg->is_config_set())
|
||||||
full_command_set.merge(std::set<std::string>{
|
full_command_set.merge(std::set<std::string>{
|
||||||
"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) {
|
for (const auto& command : full_command_set) {
|
||||||
@ -196,16 +196,22 @@ int main(int argc, char* argv[]) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cmd == "server") {
|
if (cmd == "server" || cmd == "servers" || cmd == "view" || cmd == "views" || cmd == "v")
|
||||||
if (argc > 2) {
|
switch (argc)
|
||||||
// Show details for specific server
|
{
|
||||||
dropshell::show_server_details(argv[2]);
|
case 2:
|
||||||
} else {
|
dropshell::list_servers();
|
||||||
// List all servers
|
return 0;
|
||||||
dropshell::list_servers();
|
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") {
|
if (cmd == "templates") {
|
||||||
dropshell::list_templates();
|
dropshell::list_templates();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user