Skip to content

Commit af50e2d

Browse files
committed
Add option to print version
1 parent 56a45e2 commit af50e2d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

darc/control.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import socket
1010
import subprocess
1111

12+
import darc
1213
from darc.definitions import CONFIG_FILE
1314

1415

@@ -110,12 +111,18 @@ def main():
110111
"(Default: determine from DARC config file)")
111112
parser.add_argument('--parset', type=str, help="Observation parset (takes precedence over --config)")
112113
parser.add_argument('--config', type=str, help="Node observation config")
114+
parser.add_argument('--version', action="store_true", help="Print version info")
113115

114-
parser.add_argument('cmd', type=str, nargs='+', help="Command to execute. When using get_attr, add space "
116+
parser.add_argument('cmd', type=str, nargs='*', help="Command to execute. When using get_attr, add space "
115117
"followed by attribute. Available commands: "
116118
"{}".format(', '.join(commands)))
117119
args = parser.parse_args()
118120

121+
# Print version and exit
122+
if args.version:
123+
logger.info(f"{darc.__version__}")
124+
sys.exit(0)
125+
119126
# Check arguments
120127
if not args.cmd:
121128
logger.error("Add command to execute e.g. \"darc --service amber_listener status\"")

0 commit comments

Comments
 (0)