mirror of
https://github.com/FliegendeWurst/tmux-thumbs.git
synced 2024-11-22 12:54:59 +00:00
Exclusive commands
Before this commit `command` and `upcase_command` where executed if you pressed an uppercase key. This can force the user to have a innocuous lower case command if they want to execute together. Now they can be totally independent.
This commit is contained in:
parent
a9c46486f1
commit
f15f02c26b
@ -166,7 +166,7 @@ set -g @thumbs-command 'echo {} | pbcopy'
|
||||
|
||||
### @thumbs-upcase-command
|
||||
|
||||
`default: 'tmux paste-buffer'`
|
||||
`default: 'tmux set-buffer {} && tmux paste-buffer'`
|
||||
|
||||
Choose which command execute when you press a upcase hint. `tmux-thumbs` will replace `{}` with the picked hint.
|
||||
|
||||
|
22
src/main.rs
22
src/main.rs
@ -93,7 +93,7 @@ fn app_args<'a>() -> clap::ArgMatches<'a> {
|
||||
Arg::with_name("upcase_command")
|
||||
.help("Upcase command")
|
||||
.long("upcase-command")
|
||||
.default_value("tmux paste-buffer"),
|
||||
.default_value("tmux set-buffer {} && tmux paste-buffer"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("regexp")
|
||||
@ -168,19 +168,13 @@ fn main() {
|
||||
exec_command(vec!["tmux", "swap-pane", "-t", pane]);
|
||||
};
|
||||
|
||||
if let Some((text, paste)) = selected {
|
||||
exec_command(vec![
|
||||
"bash",
|
||||
"-c",
|
||||
str::replace(command, "{}", text.as_str()).as_str(),
|
||||
]);
|
||||
if let Some((text, upcase)) = selected {
|
||||
let final_command = if upcase {
|
||||
str::replace(upcase_command, "{}", text.as_str())
|
||||
} else {
|
||||
str::replace(command, "{}", text.as_str())
|
||||
};
|
||||
|
||||
if paste {
|
||||
exec_command(vec![
|
||||
"bash",
|
||||
"-c",
|
||||
str::replace(upcase_command, "{}", text.as_str()).as_str(),
|
||||
]);
|
||||
}
|
||||
exec_command(vec!["bash", "-c", final_command.as_str()]);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user