diff --git a/src/main.rs b/src/main.rs index 9b0d96e..24e509b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ #![feature(array_chunks)] mod box_; +mod rev; mod errors; mod incr; mod invert; @@ -69,6 +70,8 @@ enum Commands { Decr(incr::Options), #[clap(about = "Decrement selections")] Incr(incr::Options), + #[clap(about = "Reverse selectinos")] + Rev(rev::Options) } fn main() { @@ -119,5 +122,6 @@ fn run() -> Result { Commands::Xlookup(o) => xlookup::xlookup(o), Commands::Incr(o) => incr::incr(o, true), Commands::Decr(o) => incr::incr(o, false), + Commands::Rev(o) => rev::rev(o), } } diff --git a/src/rev.rs b/src/rev.rs new file mode 100644 index 0000000..0279e22 --- /dev/null +++ b/src/rev.rs @@ -0,0 +1,11 @@ +use kakplugin::{get_selections, set_selections, KakError}; +#[derive(clap::StructOpt, Debug)] +pub struct Options; + +pub fn rev(_options: &Options) -> Result { + let selections = get_selections(None)?; + + set_selections(selections.iter().rev())?; + + Ok(format!("Reversed {} selections", selections.len())) +}