File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -70,9 +70,11 @@ def _check_sugar_file(file_path: str = '.sugar.yaml') -> bool:
70
70
return Path (file_path ).exists ()
71
71
72
72
73
- def version_callback () -> None :
74
- """Print the Sugar version."""
75
- SugarLogs .print_info (f'Sugar version: { __version__ } ' )
73
+ def version_callback (value : bool ) -> None :
74
+ """Print the Sugar version and exit if flag is set."""
75
+ if value :
76
+ SugarLogs .print_info (f'Sugar version: { __version__ } ' )
77
+ raise typer .Exit ()
76
78
77
79
78
80
@app .callback (invoke_without_command = True )
@@ -89,10 +91,11 @@ def main(
89
91
help = 'Set the profile of services for running the sugar command.' ,
90
92
),
91
93
version : bool = Option (
92
- None ,
94
+ False ,
93
95
'--version' ,
94
96
'-v' ,
95
97
is_flag = True ,
98
+ callback = version_callback ,
96
99
is_eager = True ,
97
100
help = 'Show the version of sugar.' ,
98
101
),
You can’t perform that action at this time.
0 commit comments