aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlnaz Nizametdinov <ilnaz@ydb.tech>2024-07-08 17:56:54 +0300
committerGitHub <noreply@github.com>2024-07-08 17:56:54 +0300
commita902648c4cda42d6df2f63ea76ddb2b658f074d9 (patch)
treeafa5f73d245dd857ab8d543983f345b160b41e6f
parentcc81c7eb0bdcd035ea66223a9d81bcc3c76f29ba (diff)
downloadydb-a902648c4cda42d6df2f63ea76ddb2b658f074d9.tar.gz
Hide deprecated operation kinds (#6407)
-rw-r--r--ydb/public/lib/ydb_cli/commands/ydb_service_operation.cpp9
-rw-r--r--ydb/public/lib/ydb_cli/commands/ydb_service_operation.h20
2 files changed, 24 insertions, 5 deletions
diff --git a/ydb/public/lib/ydb_cli/commands/ydb_service_operation.cpp b/ydb/public/lib/ydb_cli/commands/ydb_service_operation.cpp
index 8f39c52210..72b54366b7 100644
--- a/ydb/public/lib/ydb_cli/commands/ydb_service_operation.cpp
+++ b/ydb/public/lib/ydb_cli/commands/ydb_service_operation.cpp
@@ -140,7 +140,7 @@ void TCommandListOperations::InitializeKindToHandler(TConfig& config) {
{"scriptexec", &ListOperations<NQuery::TScriptExecutionOperation>},
};
if (config.UseExportToYt) {
- KindToHandler.emplace("export", &ListOperations<NExport::TExportToYtResponse>); // deprecated
+ KindToHandler.emplace("export", THandlerWrapper(&ListOperations<NExport::TExportToYtResponse>, true)); // deprecated
KindToHandler.emplace("export/yt", &ListOperations<NExport::TExportToYtResponse>);
}
}
@@ -149,11 +149,14 @@ TString TCommandListOperations::KindChoices() {
TStringBuilder help;
bool first = true;
- for (const auto& kv : KindToHandler) {
+ for (const auto& [kind, handler] : KindToHandler) {
+ if (handler.Hidden) {
+ continue;
+ }
if (!first) {
help << ", ";
}
- help << kv.first;
+ help << kind;
first = false;
}
diff --git a/ydb/public/lib/ydb_cli/commands/ydb_service_operation.h b/ydb/public/lib/ydb_cli/commands/ydb_service_operation.h
index 238901a88b..13fb8546b6 100644
--- a/ydb/public/lib/ydb_cli/commands/ydb_service_operation.h
+++ b/ydb/public/lib/ydb_cli/commands/ydb_service_operation.h
@@ -51,7 +51,23 @@ public:
class TCommandListOperations : public TYdbCommand,
public TCommandWithFormat {
- using THandler = std::function<void(NOperation::TOperationClient&, ui64, const TString&, EOutputFormat)>;
+ struct THandlerWrapper {
+ using THandler = std::function<void(NOperation::TOperationClient&, ui64, const TString&, EOutputFormat)>;
+
+ THandler Handler;
+ bool Hidden;
+
+ template <typename T>
+ THandlerWrapper(T&& handler, bool hidden = false)
+ : Handler(std::forward<T>(handler))
+ , Hidden(hidden)
+ {}
+
+ template <typename... Args>
+ auto operator()(Args&&... args) {
+ return Handler(std::forward<Args>(args)...);
+ }
+ };
void InitializeKindToHandler(TConfig& config);
TString KindChoices();
@@ -66,7 +82,7 @@ private:
TString Kind;
ui64 PageSize = 0;
TString PageToken;
- THashMap<TString, THandler> KindToHandler;
+ THashMap<TString, THandlerWrapper> KindToHandler;
};
}