File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed
Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,11 @@ impl Linter {
8585 "Running linter {}: {} {}" ,
8686 self . code,
8787 program[ 0 ] ,
88- arguments. join( " " )
88+ arguments
89+ . iter( )
90+ . map( |x| format!( "'{x}'" ) )
91+ . collect:: <Vec <_>>( )
92+ . join( " " )
8993 ) ;
9094
9195 let start = std:: time:: Instant :: now ( ) ;
Original file line number Diff line number Diff line change 1+ use crate :: persistent_data:: PersistentDataStore ;
2+ use anyhow:: Result ;
3+ use console:: style;
4+ use dialoguer:: { theme:: ColorfulTheme , Select } ;
5+
6+ pub fn do_rage (
7+ persistent_data_store : & PersistentDataStore ,
8+ invocation : Option < usize > ,
9+ ) -> Result < i32 > {
10+ let run = match invocation {
11+ Some ( invocation) => Some ( persistent_data_store. run ( invocation) ?) ,
12+ None => {
13+ let runs = persistent_data_store. runs ( ) ?;
14+ let items: Vec < String > = persistent_data_store
15+ . runs ( ) ?
16+ . iter ( )
17+ . map ( |run| run. timestamp . to_string ( ) + ": " + & run. args . join ( " " ) )
18+ . collect ( ) ;
19+
20+ let selection = Select :: with_theme ( & ColorfulTheme :: default ( ) )
21+ . with_prompt ( "Select a past invocation to report" )
22+ . items ( & items)
23+ . default ( 0 )
24+ . interact_opt ( ) ?;
25+
26+ selection. map ( |i| runs. into_iter ( ) . nth ( i) . unwrap ( ) )
27+ }
28+ } ;
29+
30+ match run {
31+ Some ( run) => {
32+ let report = persistent_data_store. get_run_report ( & run) ?;
33+ print ! ( "{}" , report) ;
34+ Ok ( 0 )
35+ }
36+ None => {
37+ println ! ( "{}" , style( "Nothing selected, exiting." ) . yellow( ) ) ;
38+ Ok ( 1 )
39+ }
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments