First commit that works
This commit is contained in:
parent
211c7b7e26
commit
20c43a5f6a
18
README.adoc
Normal file
18
README.adoc
Normal file
@ -0,0 +1,18 @@
|
||||
= rust-selection-sort.kak
|
||||
|
||||
== Configuration
|
||||
|
||||
[source,title='kakrc']
|
||||
----
|
||||
define-command s -params 0..1 %{
|
||||
eval -save-regs '"' %{
|
||||
reg dquote %val{selections}
|
||||
eval %sh{
|
||||
regex="${1:-.*}"
|
||||
eval set -- "$kak_quoted_selections"
|
||||
~/syncthing/code/rust-selection-sort.kak/target/debug/rust-selection-sort "$regex" "$@" > "$kak_command_fifo"
|
||||
}
|
||||
exec R
|
||||
}
|
||||
}
|
||||
----
|
@ -4,7 +4,7 @@ use regex::Regex;
|
||||
use std::env;
|
||||
fn main() {
|
||||
let args = env::args().collect::<Vec<String>>();
|
||||
assert!(args.len() < 2, "Usage: rust-selection-sort REGEX SEL1 [SEL2 ...]");
|
||||
assert!(args.len() > 2, "Usage: rust-selection-sort REGEX SEL1 [SEL2 ...]");
|
||||
|
||||
let replacement_re = &args[1];
|
||||
|
||||
@ -28,9 +28,13 @@ fn main() {
|
||||
a.cmp(b)
|
||||
});
|
||||
|
||||
print!("reg '\"'");
|
||||
for i in &zipped {
|
||||
print!("{}\0", i.0);
|
||||
let new_selection = i.0.replace("'", "''");
|
||||
print!(" '{}'", new_selection);
|
||||
// print!("{}\0", new_selection);
|
||||
// TODO: Allow debugging with -d
|
||||
// println!("\n\tSort key: {:?}", i.1);
|
||||
}
|
||||
print!(" ;");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user