This repository was archived by the owner on Jul 26, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -30,10 +30,11 @@ impl Fzf {
30
30
}
31
31
}
32
32
33
- pub fn write_to_stdin ( & mut self , input : & [ u8 ] ) -> Result < ( ) > {
34
- if let Err ( why) = self . process . stdin . as_mut ( ) . unwrap ( ) . write_all ( input) {
35
- panic ! ( "couldn't write to fzf stdin: {}" , why)
36
- }
33
+ pub fn write_to_stdin ( & mut self , input : & [ PluginInfo ] ) -> Result < ( ) > {
34
+ let stdin = self . process . stdin . as_mut ( ) . unwrap ( ) ;
35
+ input. iter ( ) . for_each ( |plugin| {
36
+ writeln ! ( stdin, "{}" , plugin. to_string( ) ) . unwrap ( ) ;
37
+ } ) ;
37
38
Ok ( ( ) )
38
39
}
39
40
Original file line number Diff line number Diff line change @@ -22,9 +22,10 @@ async fn main() -> Result<()> {
22
22
} ) ;
23
23
let astro = Astrocommunity :: new ( ) ;
24
24
let plugins = astro. get_plugins ( ) ?;
25
+ dbg ! ( plugins. len( ) ) ;
25
26
let mut fzf = fzf:: Fzf :: new ( ) ?;
26
27
let fzf_string: String = plugins. iter ( ) . map ( |plugin| plugin. to_string ( ) ) . join ( "\n " ) ;
27
- fzf. write_to_stdin ( fzf_string . as_bytes ( ) ) ?;
28
+ fzf. write_to_stdin ( & plugins ) ?;
28
29
let selected_plugins = fzf. get_selected_plugins ( & plugins) ?;
29
30
let mut import_statement = String :: with_capacity ( 50 * selected_plugins. len ( ) ) ;
30
31
for item in selected_plugins. iter ( ) {
You can’t perform that action at this time.
0 commit comments