File tree Expand file tree Collapse file tree 3 files changed +14
-0
lines changed
Expand file tree Collapse file tree 3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change 11from cfengine_cli .shell import user_command
22from cfengine_cli .paths import bin
3+ from cfengine_cli .version import string as version_string
34
45
56def run () -> int :
@@ -18,3 +19,8 @@ def help() -> int:
1819 print ("Example usage:" )
1920 print ("cfengine run" )
2021 return 0
22+
23+
24+ def version () -> int :
25+ print (version_string ())
26+ return 0
Original file line number Diff line number Diff line change @@ -50,6 +50,11 @@ def _get_arg_parser():
5050 help = "Run the agent and hub commands necessary to get new reporting data" ,
5151 )
5252
53+ subp .add_parser (
54+ "version" ,
55+ help = "Print the version string" ,
56+ )
57+
5358 return ap
5459
5560
@@ -66,6 +71,8 @@ def run_command_with_args(command, _) -> int:
6671 return commands .report ()
6772 if command == "help" :
6873 return commands .help ()
74+ if command == "version" :
75+ return commands .versions ()
6976 raise UserError ("Unknown command: '{}'" .format (command ))
7077
7178
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ class UserError(Exception):
33
44 def __init__ (self , message ):
55 super ().__init__ (message )
6+ self .message = message
67
78 def __str__ (self ):
89 return f"Error: { self .message } "
You can’t perform that action at this time.
0 commit comments