@@ -90,12 +90,12 @@ def scan_command(
90
90
'JSON always exports JSON.' ,
91
91
rich_help_panel = _EXPORT_RICH_HELP_PANEL ,
92
92
),
93
- ] = ExportTypeOption . JSON ,
93
+ ] = None ,
94
94
export_file : Annotated [
95
95
Optional [Path ],
96
96
typer .Option (
97
97
'--export-file' ,
98
- help = 'Export file. Path to the file where the export will be saved. ' ,
98
+ help = 'Export file. Path to the file where the export will be saved.' ,
99
99
dir_okay = False ,
100
100
writable = True ,
101
101
rich_help_panel = _EXPORT_RICH_HELP_PANEL ,
@@ -118,6 +118,17 @@ def scan_command(
118
118
"""
119
119
add_breadcrumb ('scan' )
120
120
121
+ if export_file and export_type is None :
122
+ raise typer .BadParameter (
123
+ 'Export type must be specified when --export-file is provided.' ,
124
+ param_hint = '--export-type' ,
125
+ )
126
+ if export_type and export_file is None :
127
+ raise typer .BadParameter (
128
+ 'Export file must be specified when --export-type is provided.' ,
129
+ param_hint = '--export-file' ,
130
+ )
131
+
121
132
ctx .obj ['show_secret' ] = show_secret
122
133
ctx .obj ['soft_fail' ] = soft_fail
123
134
ctx .obj ['client' ] = get_scan_cycode_client (ctx )
@@ -126,7 +137,7 @@ def scan_command(
126
137
ctx .obj ['severity_threshold' ] = severity_threshold
127
138
ctx .obj ['monitor' ] = monitor
128
139
129
- if export_file :
140
+ if export_type and export_file :
130
141
console_printer = ctx .obj ['console_printer' ]
131
142
console_printer .enable_recording (export_type , export_file )
132
143
@@ -142,7 +153,8 @@ def _sca_scan_to_context(ctx: typer.Context, sca_scan_user_selected: list[str])
142
153
143
154
@click .pass_context
144
155
def scan_command_result_callback (ctx : click .Context , * _ , ** __ ) -> None :
145
- add_breadcrumb ('scan_finalize' )
156
+ add_breadcrumb ('scan_finalized' )
157
+ ctx .obj ['scan_finalized' ] = True
146
158
147
159
progress_bar = ctx .obj .get ('progress_bar' )
148
160
if progress_bar :
0 commit comments