aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkruall <kruall@ydb.tech>2025-03-27 17:47:11 +0300
committerGitHub <noreply@github.com>2025-03-27 14:47:11 +0000
commit6b8ffd922403171f9968f00cc9d44857a33af2b7 (patch)
tree80c7fcaf469e7361f2ec3409218313af3fedf03d
parentc478f575c7a170a1af214674607e8ad98558eb53 (diff)
downloadydb-6b8ffd922403171f9968f00cc9d44857a33af2b7.tar.gz
Add showing vesion option to dstool (#16347)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
-rwxr-xr-xydb/apps/dstool/main.py18
-rw-r--r--ydb/apps/dstool/version.txt2
-rw-r--r--ydb/apps/dstool/ya.make5
3 files changed, 24 insertions, 1 deletions
diff --git a/ydb/apps/dstool/main.py b/ydb/apps/dstool/main.py
index 0042dd4073a..8c233823c1c 100755
--- a/ydb/apps/dstool/main.py
+++ b/ydb/apps/dstool/main.py
@@ -4,12 +4,30 @@ from ydb.apps.dstool.lib.arg_parser import ArgumentParser
import ydb.apps.dstool.lib.common as common
import ydb.apps.dstool.lib.commands as commands
+from __res import find
+
import sys
+def get_version():
+ try:
+ return find('version.txt').decode('utf-8').strip()
+ except FileNotFoundError:
+ return "unknown"
+ except UnicodeDecodeError:
+ return "unknown"
+
+
def main():
parser = ArgumentParser(description='YDB Distributed Storage Administration Tool')
+ parser.add_argument('--version', '-v', action='store_true', help='Show version')
+ args = parser.parse_args()
+
+ if args.version:
+ print(get_version())
+ sys.exit(0)
+
# common options
common.add_host_access_options(parser)
parser.add_argument('--dry-run', '-n', action='store_true', help='Run command without side effects')
diff --git a/ydb/apps/dstool/version.txt b/ydb/apps/dstool/version.txt
index 43b29618309..9789c4ccb0c 100644
--- a/ydb/apps/dstool/version.txt
+++ b/ydb/apps/dstool/version.txt
@@ -1 +1 @@
-0.0.13
+0.0.14
diff --git a/ydb/apps/dstool/ya.make b/ydb/apps/dstool/ya.make
index e4144965b54..e712c05a66b 100644
--- a/ydb/apps/dstool/ya.make
+++ b/ydb/apps/dstool/ya.make
@@ -10,6 +10,11 @@ PY_SRCS(
PEERDIR(
ydb/apps/dstool/lib
+ contrib/python/six
+)
+
+RESOURCE(
+ ydb/apps/dstool/version.txt version.txt
)
END()