This commit is contained in:
j842 2025-05-05 14:45:47 +12:00
parent c0dc928070
commit 0462748336
5 changed files with 8 additions and 6 deletions

View File

@ -90,11 +90,11 @@ void dropshell::autocomplete_list_commands()
// add in commmands hard-coded and handled in main // add in commmands hard-coded and handled in main
commands.merge(std::set<std::string>{ commands.merge(std::set<std::string>{
"help","init" // these are always available. "help","edit" // these are always available.
}); });
if (dropshell::gConfig().is_config_set()) if (dropshell::gConfig().is_config_set())
commands.merge(std::set<std::string>{ commands.merge(std::set<std::string>{
"server","templates","create-service","create-template","create-server","edit","ssh", "server","templates","create-service","create-template","create-server","ssh",
"list" // only if we have a config. "list" // only if we have a config.
}); });
for (const auto& command : commands) { for (const auto& command : commands) {

View File

@ -187,7 +187,8 @@ void create_server(const std::string &server_name)
// 2. create a new directory in the user config directory // 2. create a new directory in the user config directory
auto lsdp = gConfig().get_local_server_definition_paths(); auto lsdp = gConfig().get_local_server_definition_paths();
if (lsdp.empty() || lsdp[0].empty()) { if (lsdp.empty() || lsdp[0].empty()) {
std::cerr << "Error: Local server definition path not found - is DropShell initialised?" << std::endl; std::cerr << "Error: Local server definition path not found" << std::endl;
std::cerr << "Run 'dropshell edit' to configure DropShell" << std::endl;
return; return;
} }
std::string server_dir = lsdp[0] + "/" + server_name; std::string server_dir = lsdp[0] + "/" + server_name;

View File

@ -627,7 +627,8 @@ bool service_runner::backup(bool silent) {
// Create backups directory locally if it doesn't exist // Create backups directory locally if it doesn't exist
std::string local_backups_dir = gConfig().get_local_backup_path(); std::string local_backups_dir = gConfig().get_local_backup_path();
if (local_backups_dir.empty()) { if (local_backups_dir.empty()) {
std::cerr << "Error: Local backups directory not found - is DropShell initialised?" << std::endl; std::cerr << "Error: Local backups directory not found" << std::endl;
std::cerr << "Run 'dropshell edit' to configure DropShell" << std::endl;
return false; return false;
} }
if (!std::filesystem::exists(local_backups_dir)) if (!std::filesystem::exists(local_backups_dir))

View File

@ -23,7 +23,7 @@ std::vector<LocalServiceInfo> get_server_services_info(const std::string& server
std::vector<std::string> local_server_definition_paths = gConfig().get_local_server_definition_paths(); std::vector<std::string> local_server_definition_paths = gConfig().get_local_server_definition_paths();
if (local_server_definition_paths.empty()) { if (local_server_definition_paths.empty()) {
std::cerr << "Error: No local server definition paths found" << std::endl; std::cerr << "Error: No local server definition paths found" << std::endl;
std::cerr << "Run 'dropshell init' to initialise DropShell" << std::endl; std::cerr << "Run 'dropshell edit' to configure DropShell" << std::endl;
return services; return services;
} }

View File

@ -175,7 +175,7 @@
if (local_server_definition_paths.empty()) { if (local_server_definition_paths.empty()) {
std::cerr << "Error: No local server definition paths found" << std::endl; std::cerr << "Error: No local server definition paths found" << std::endl;
std::cerr << "Run 'dropshell init' to initialise DropShell" << std::endl; std::cerr << "Run 'dropshell edit' to configure DropShell" << std::endl;
return; return;
} }