diff --git a/README.adoc b/README.adoc index b4e5675..cd4cdcb 100644 --- a/README.adoc +++ b/README.adoc @@ -47,8 +47,7 @@ define-command sort-selections -params 0.. %{ # TODO: Send additional parameters - rust-selection-sort -R "$regex" -f "$kak_command_fifo" -- "$@" - + rust-selection-sort -R "$regex" $args -- "$@" > "$kak_command_fifo" } exec R } diff --git a/src/main.rs b/src/main.rs index bd6c7bf..787fd31 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,8 +3,6 @@ use alphanumeric_sort::compare_str; use clap::Parser; use regex::Regex; -use std::fs::OpenOptions; -use std::io::Write; use std::path::PathBuf; struct KakMessage(String, Option); @@ -93,12 +91,7 @@ fn run() -> Result<(), KakMessage> { } }); - let mut f = OpenOptions::new() - .write(true) - .append(true) - .open(&options.fifo_name)?; - - write!(f, "reg '\"'")?; + print!("reg '\"'"); let iter: Box> = if options.reverse { Box::new(zipped.iter().rev()) @@ -108,9 +101,9 @@ fn run() -> Result<(), KakMessage> { for i in iter { let new_selection = i.0.replace('\'', "''"); - write!(f, " '{}'", new_selection)?; + print!(" '{}'", new_selection); } - write!(f, " ;")?; + print!(" ;"); Ok(()) }