dropshell release 2025.0518.1451
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
This commit is contained in:
@ -48,7 +48,7 @@ void help_autocomplete(const CommandContext& ctx) {
|
||||
if (ctx.args.size() == 1) {
|
||||
// list all commands
|
||||
for (const auto& cmd : CommandRegistry::instance().list_primary_commands(false)) {
|
||||
std::cout << cmd << std::endl;
|
||||
rawout << cmd << std::endl;
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -58,13 +58,13 @@ void show_command(const std::string& cmd) {
|
||||
const auto& cmd_info = CommandRegistry::instance().find_command(cmd);
|
||||
if (!cmd_info)
|
||||
{
|
||||
std::cout << "Unknown command: " << cmd << std::endl;
|
||||
error << "Unknown command: " << cmd << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << " ";
|
||||
print_left_aligned(cmd_info->help_usage, 32);
|
||||
std::cout << cmd_info->help_description << std::endl;
|
||||
info << " ";
|
||||
info << left_align(cmd_info->help_usage, 32);
|
||||
info << cmd_info->help_description << std::endl;
|
||||
}
|
||||
|
||||
extern const std::string VERSION;
|
||||
@ -77,28 +77,26 @@ int show_command_help(const std::string& cmd) {
|
||||
const auto& cmd_info = CommandRegistry::instance().find_command(cmd);
|
||||
if (!cmd_info)
|
||||
{
|
||||
std::cout << "Unknown command: " << cmd << std::endl;
|
||||
error << "Unknown command: " << cmd << std::endl;
|
||||
return 1;
|
||||
}
|
||||
info << "Command " << cmd << " usage:" << std::endl;
|
||||
info << " ";
|
||||
info << left_align(cmd_info->help_usage, 32);
|
||||
info << cmd_info->help_description << std::endl;
|
||||
|
||||
std::cout << std::endl;
|
||||
std::cout << "Usage: " << std::endl;
|
||||
std::cout << " ";
|
||||
print_left_aligned(cmd_info->help_usage, 30);
|
||||
std::cout << cmd_info->help_description << std::endl;
|
||||
info << std::endl;
|
||||
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << " Equivalent names: ";
|
||||
info << " Equivalent names: ";
|
||||
bool first = true;
|
||||
for (const auto& name : cmd_info->names) {
|
||||
if (!first) std::cout << ", ";
|
||||
std::cout << name;
|
||||
if (!first) info << ", ";
|
||||
info << name;
|
||||
first = false;
|
||||
}
|
||||
std::cout << std::endl << std::endl;
|
||||
info << std::endl;
|
||||
|
||||
std::cout << cmd_info->full_help << std::endl << std::endl;
|
||||
info << cmd_info->full_help << std::endl << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -108,12 +106,12 @@ int help_handler(const CommandContext& ctx) {
|
||||
if (ctx.args.size() > 0)
|
||||
return show_command_help(ctx.args[0]);
|
||||
|
||||
std::cout << std::endl;
|
||||
info << std::endl;
|
||||
maketitle("DropShell version " + VERSION);
|
||||
std::cout << std::endl;
|
||||
std::cout << "A tool for managing remote servers, by " << AUTHOR << std::endl;
|
||||
std::cout << std::endl;
|
||||
std::cout << "dropshell ..." << std::endl;
|
||||
info << std::endl;
|
||||
info << "A tool for managing remote servers, by " << AUTHOR << std::endl;
|
||||
info << std::endl;
|
||||
info << "dropshell ..." << std::endl;
|
||||
|
||||
show_command("help");
|
||||
show_command("edit");
|
||||
@ -136,56 +134,6 @@ int help_handler(const CommandContext& ctx) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// void show_command(const std::string& cmd) {
|
||||
// const auto& cmd_info = CommandRegistry::instance().find_command(cmd);
|
||||
// if (cmd_info) {
|
||||
// std::cout << " " << cmd_info->help_usage
|
||||
// << std::string(' ', std::min(1,(int)(30-cmd_info->help_usage.length())))
|
||||
// << cmd_info->help_description << std::endl;
|
||||
// }
|
||||
// }
|
||||
|
||||
// bool print_help() {
|
||||
// std::cout << std::endl;
|
||||
// maketitle("DropShell version " + VERSION);
|
||||
// std::cout << std::endl;
|
||||
// std::cout << "A tool for managing server configurations" << std::endl;
|
||||
// std::cout << std::endl;
|
||||
// std::cout << "dropshell ..." << std::endl;
|
||||
// show_command("help");
|
||||
// show_command("edit");
|
||||
|
||||
// if (gConfig().is_config_set()) {
|
||||
// std::cout << " templates List all available templates" << std::endl;
|
||||
// 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 << " list [SERVER] [SERVICE] List 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 << std::endl;
|
||||
// std::cout << " install SERVER [SERVICE] Install/reinstall/update service(s). Safe/non-destructive." << std::endl;
|
||||
// std::cout << " uninstall SERVER [SERVICE] Uninstalls the service on the remote server. Leaves data intact." << std::endl;
|
||||
// std::cout << " nuke SERVER SERVICE Nuke the service, deleting ALL local and remote data." << std::endl;
|
||||
// std::cout << std::endl;
|
||||
// std::cout << " COMMAND SERVER [SERVICE] Run a command on service(s), e.g." << std::endl;
|
||||
// std::cout << " backup, restore, start, stop, logs" << std::endl;
|
||||
// std::cout << std::endl;
|
||||
// std::cout << " ssh SERVER SERVICE Launch an interactive shell on a server or service" << std::endl;
|
||||
// std::cout << std::endl;
|
||||
// std::cout << "Creation commands: (apply to the first local config directory)"<<std::endl;
|
||||
// std::cout << " create-template TEMPLATE" << std::endl;
|
||||
// std::cout << " create-server SERVER" << std::endl;
|
||||
// std::cout << " create-service SERVER TEMPLATE SERVICE" << std::endl;
|
||||
// }
|
||||
// else {
|
||||
// show_command("help");
|
||||
// show_command("edit");
|
||||
// std::cout << std::endl;
|
||||
// std::cout << "Other commands available once initialised." << std::endl;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
} // namespace dropshell
|
||||
|
Reference in New Issue
Block a user