mirror of
https://github.com/nestriness/cdc-file-transfer.git
synced 2026-05-02 00:23:06 +03:00
[cdc_stream] Add wildcard support to stop command (#30)
Adds support for stuff like cdc_stream stop * or cdc_stream stop user*:dir*.
This commit is contained in:
@@ -53,7 +53,7 @@ void StopCommand::RegisterCommandLineFlags(lyra::command& cmd) {
|
||||
std::to_string(SessionManagementServer::kDefaultServicePort)));
|
||||
|
||||
cmd.add_argument(
|
||||
lyra::arg(PosArgValidator(&user_host_dir_), "[user@]host:src-dir")
|
||||
lyra::arg(PosArgValidator(&user_host_dir_), "[user@]host:dir")
|
||||
.required()
|
||||
.help("Linux host and directory to stream to"));
|
||||
}
|
||||
@@ -70,8 +70,14 @@ absl::Status StopCommand::Run() {
|
||||
LocalAssetsStreamManagerClient client(channel);
|
||||
|
||||
std::string user_host, mount_dir;
|
||||
RETURN_IF_ERROR(LocalAssetsStreamManagerClient::ParseUserHostDir(
|
||||
user_host_dir_, &user_host, &mount_dir));
|
||||
if (user_host_dir_ == "*") {
|
||||
// Convenience shortcut "*" for "*:*".
|
||||
user_host = "*";
|
||||
mount_dir = "*";
|
||||
} else {
|
||||
RETURN_IF_ERROR(LocalAssetsStreamManagerClient::ParseUserHostDir(
|
||||
user_host_dir_, &user_host, &mount_dir));
|
||||
}
|
||||
|
||||
absl::Status status = client.StopSession(user_host, mount_dir);
|
||||
if (status.ok()) {
|
||||
|
||||
Reference in New Issue
Block a user