From 20679c52bcc75c2e51460adc32a274f91ac6879e Mon Sep 17 00:00:00 2001 From: Andrew Beltrano Date: Mon, 25 Mar 2024 16:08:05 +0000 Subject: [PATCH] ALlow omitting server argument. --- src/common/tools/cli/NetRemoteCli.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/tools/cli/NetRemoteCli.cxx b/src/common/tools/cli/NetRemoteCli.cxx index 8bf83fa5..ad43bd72 100644 --- a/src/common/tools/cli/NetRemoteCli.cxx +++ b/src/common/tools/cli/NetRemoteCli.cxx @@ -74,10 +74,13 @@ NetRemoteCli::CreateParser() noexcept app->require_subcommand(); + const std::string serverAddressDefault{ Protocol::NetRemoteProtocol::AddressDefault }; auto* optionServer = app->add_option_function("-s,--server", [this](const std::string& serverAddress) { OnServerAddressChanged(serverAddress); }); optionServer->description("The address of the netremote server to connect to, with format '[:port]'"); + optionServer->default_val(serverAddressDefault)->run_callback_for_default()->force_callback(); + optionServer->default_str(serverAddressDefault); m_cliAppServerAddress = optionServer; m_cliAppWifi = AddSubcommandWifi(app.get()); @@ -279,6 +282,7 @@ NetRemoteCli::OnServerAddressChanged(const std::string& serverAddressArg) serverAddress += std::format("{}{}", NetRemoteProtocol::PortSeparator, NetRemoteProtocol::PortDefault); } + LOGI << std::format("Connecting to server {}", serverAddress); m_cliData->ServerAddress = std::move(serverAddress); auto connection = NetRemoteServerConnection::TryEstablishConnection(m_cliData->ServerAddress);