Skip to content

Commit

Permalink
ALlow omitting server argument.
Browse files Browse the repository at this point in the history
  • Loading branch information
abeltrano committed Mar 25, 2024
1 parent 6a91f67 commit 20679c5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/common/tools/cli/NetRemoteCli.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,13 @@ NetRemoteCli::CreateParser() noexcept

app->require_subcommand();

const std::string serverAddressDefault{ Protocol::NetRemoteProtocol::AddressDefault };
auto* optionServer = app->add_option_function<std::string>("-s,--server", [this](const std::string& serverAddress) {
OnServerAddressChanged(serverAddress);
});
optionServer->description("The address of the netremote server to connect to, with format '<hostname>[:port]'");
optionServer->default_val(serverAddressDefault)->run_callback_for_default()->force_callback();
optionServer->default_str(serverAddressDefault);

m_cliAppServerAddress = optionServer;
m_cliAppWifi = AddSubcommandWifi(app.get());
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 20679c5

Please sign in to comment.