This commit is contained in:
parent
4c0bca4def
commit
583bb18676
@ -33,7 +33,7 @@ namespace dropshell
|
||||
false, // requires_install
|
||||
0, // min_args (after command)
|
||||
2, // max_args (after command)
|
||||
"install SERVER [SERVICE]",
|
||||
"install SERVER [SERVICE|all]",
|
||||
"Install/reinstall service(s). Safe/non-destructive way to update.",
|
||||
// heredoc
|
||||
R"(
|
||||
@ -42,7 +42,7 @@ namespace dropshell
|
||||
|
||||
install (re)install dropshell components on this computer.
|
||||
install SERVER (re)install dropshell agent on the given server.
|
||||
install SERVER [SERVICE|*] (re)install the given service (or all services) on the given server.
|
||||
install SERVER [SERVICE|all] (re)install the given service (or all services) on the given server.
|
||||
|
||||
Note you need to create the service first with:
|
||||
dropshell create-service <server> <template> <service>
|
||||
@ -360,6 +360,12 @@ namespace dropshell
|
||||
return install_host();
|
||||
}
|
||||
|
||||
if (!gConfig().is_config_set())
|
||||
{
|
||||
std::cerr << "Error: Dropshell is not configured. Please run 'dropshell edit' to configure it." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string server = safearg(ctx.args, 0);
|
||||
|
||||
if (ctx.args.size() == 1)
|
||||
@ -368,9 +374,10 @@ namespace dropshell
|
||||
}
|
||||
|
||||
// install service(s)
|
||||
if (safearg(ctx.args, 1) == "*")
|
||||
if (safearg(ctx.args, 1) == "all")
|
||||
{
|
||||
// install all services on the server
|
||||
maketitle("Installing all services on " + server);
|
||||
bool okay = true;
|
||||
std::vector<LocalServiceInfo> services = get_server_services_info(server);
|
||||
for (const auto &service : services)
|
||||
|
@ -30,7 +30,7 @@ void std_autocomplete_allowstar(const CommandContext &ctx)
|
||||
{
|
||||
std_autocomplete(ctx);
|
||||
if (ctx.args.size() == 1)
|
||||
std::cout << "*" << std::endl;
|
||||
std::cout << "all" << std::endl;
|
||||
}
|
||||
|
||||
} // namespace dropshell
|
@ -69,8 +69,9 @@ int main(int argc, char* argv[]) {
|
||||
int arg_count = ctx.args.size();
|
||||
if (arg_count < info->min_args || (info->max_args != -1 && arg_count > info->max_args)) {
|
||||
std::cerr << "Invalid number of arguments for command: " << ctx.command << std::endl;
|
||||
std::cerr << "(" << ctx.args.size() << " args provided, " << ctx.command << " requires " << (info->min_args) << " to " << (info->max_args) << " args)" << std::endl;
|
||||
std::cerr << "Usage: " << std::endl;
|
||||
std::cout << " ";
|
||||
std::cerr << " ";
|
||||
print_left_aligned(info->help_usage,30);
|
||||
std::cout << info->help_description << std::endl;
|
||||
return 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user