@@ -90,12 +90,12 @@ def scan_command(
9090 'JSON always exports JSON.' ,
9191 rich_help_panel = _EXPORT_RICH_HELP_PANEL ,
9292 ),
93- ] = ExportTypeOption . JSON ,
93+ ] = None ,
9494 export_file : Annotated [
9595 Optional [Path ],
9696 typer .Option (
9797 '--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.' ,
9999 dir_okay = False ,
100100 writable = True ,
101101 rich_help_panel = _EXPORT_RICH_HELP_PANEL ,
@@ -118,6 +118,17 @@ def scan_command(
118118 """
119119 add_breadcrumb ('scan' )
120120
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+
121132 ctx .obj ['show_secret' ] = show_secret
122133 ctx .obj ['soft_fail' ] = soft_fail
123134 ctx .obj ['client' ] = get_scan_cycode_client (ctx )
@@ -126,7 +137,7 @@ def scan_command(
126137 ctx .obj ['severity_threshold' ] = severity_threshold
127138 ctx .obj ['monitor' ] = monitor
128139
129- if export_file :
140+ if export_type and export_file :
130141 console_printer = ctx .obj ['console_printer' ]
131142 console_printer .enable_recording (export_type , export_file )
132143
@@ -142,7 +153,8 @@ def _sca_scan_to_context(ctx: typer.Context, sca_scan_user_selected: list[str])
142153
143154@click .pass_context
144155def scan_command_result_callback (ctx : click .Context , * _ , ** __ ) -> None :
145- add_breadcrumb ('scan_finalize' )
156+ add_breadcrumb ('scan_finalized' )
157+ ctx .obj ['scan_finalized' ] = True
146158
147159 progress_bar = ctx .obj .get ('progress_bar' )
148160 if progress_bar :
0 commit comments