@ -76,30 +76,30 @@ let read_report report_json = Atdgen_runtime.Util.Json.from_file Jsonbug_j.read_
let explore ~ selector_limit ~ report_txt : _ ~ report_json ~ show_source_context ~ selected
~ max_nested_level =
let report = read_report report_json in
let issue_to_display =
let display_issue issue =
L . result " @ \n %a " ( pp_issue_with_trace ~ show_source_context ~ max_nested_level ) issue
in
match ( selected , report ) with
| Some n , _ -> (
| Some ` All , _ ->
List . iteri report ~ f : ( fun n issue -> display_issue ( n , issue ) )
| Some ( ` Select n ) , _ -> (
(* an issue number has been pre-selected, use that *)
match List . nth report n with
| None ->
L . die UserError " Cannot select issues #%d: only %d issues in '%s' " n ( List . length report )
report_json
| Some issue ->
Som e ( n , issue ) )
display_issu e ( n , issue ) )
| None , [] ->
(* empty report, can't print anything *)
L . progress " No issues found in '%s', exiting.@ \n " report_json ;
None
L . progress " No issues found in '%s', exiting.@ \n " report_json
| None , [ issue ] ->
(* single-issue report: no need to prompt the user to select which issue to display *)
L . progress " Auto-selecting the only issue in '%s'@ \n %! " report_json ;
Som e ( 0 , issue )
display_issu e ( 0 , issue )
| None , _ :: _ :: _ ->
(* user prompt *)
Some ( user_select_issue ~ selector_limit report )
in
Option . iter issue_to_display ~ f : ( fun issue ->
L . result " @ \n %a " ( pp_issue_with_trace ~ show_source_context ~ max_nested_level ) issue )
display_issue ( user_select_issue ~ selector_limit report )
module GitHub = struct