summaryrefslogtreecommitdiffstats
path: root/src/commands
diff options
context:
space:
mode:
authorJeff Zhao <jeff.no.zhao@gmail.com>2021-02-02 22:46:40 -0500
committerJeff Zhao <jeff.no.zhao@gmail.com>2021-02-02 22:46:40 -0500
commit54878a4955e95ec0eee70ef772a442db7ff9f65b (patch)
tree7e25767ab12e327d69e07d3a2fa261155e299161 /src/commands
parent0f1c106b611632704618b44b3e8dd05678e5e4bb (diff)
cargo fmt
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/file_ops.rs26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/commands/file_ops.rs b/src/commands/file_ops.rs
index 37fd3a1..96869ac 100644
--- a/src/commands/file_ops.rs
+++ b/src/commands/file_ops.rs
@@ -59,22 +59,32 @@ pub fn copy_filename(context: &mut JoshutoContext) -> JoshutoResult<()> {
};
if let Some(file_name) = entry_file_name {
let clipboards = [
- ("wl-copy", format!("printf '%s' {} | {} 2> /dev/null", file_name, "wl-copy")),
- ("xsel", format!("printf '%s' {} | {} -ib 2> /dev/null", file_name, "xsel")),
- ("xclip", format!("printf '%s' {} | {} -selection clipboard 2> /dev/null", file_name, "xclip")),
+ (
+ "wl-copy",
+ format!("printf '%s' {} | {} 2> /dev/null", file_name, "wl-copy"),
+ ),
+ (
+ "xsel",
+ format!("printf '%s' {} | {} -ib 2> /dev/null", file_name, "xsel"),
+ ),
+ (
+ "xclip",
+ format!(
+ "printf '%s' {} | {} -selection clipboard 2> /dev/null",
+ file_name, "xclip"
+ ),
+ ),
];
for (clipboard, command) in clipboards.iter() {
- match Command::new("sh")
- .args(&["-c", command.as_str()])
- .status() {
+ match Command::new("sh").args(&["-c", command.as_str()]).status() {
Ok(s) if s.success() => return Ok(()),
- _ => {},
+ _ => {}
}
}
let err = Err(JoshutoError::new(
JoshutoErrorKind::ClipboardError,
- "Failed to copy to clipboard".to_string()
+ "Failed to copy to clipboard".to_string(),
));
return err;
}