summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrabite <rabite@posteo.de>2019-06-17 18:05:25 +0200
committerrabite <rabite@posteo.de>2019-06-18 12:58:42 +0200
commit752d6ab8f52c540228a2586a01338cdd706de9e5 (patch)
treeba7a92ba5236678c57722c02715c02d9c7b3cc65
parentd23401c8ff58d5d57a01f5896528f517ffff4ad3 (diff)
add comments to proclist.rs
-rw-r--r--src/proclist.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/proclist.rs b/src/proclist.rs
index 7115234..c561fcf 100644
--- a/src/proclist.rs
+++ b/src/proclist.rs
@@ -59,10 +59,13 @@ impl Cmd {
let cwd_pat = OsString::from("$s");
let cwd_files = self.cwd_files
.take()
- .unwrap()
+ .unwrap() // There always is a file, even if just place holder
.iter()
- .map(|file| file.strip_prefix(&self.cwd)
+ .map(|file|
+ // strip out the cwd part to make path shorter
+ file.strip_prefix(&self.cwd)
.into_os_string()
+ // escape single quotes so file names with them work
.escape_single_quote())
.collect::<Vec<OsString>>();
@@ -82,8 +85,11 @@ impl Cmd {
.fold(cmd, |cmd, (i, tab_files)| {
let tab_files_pat = OsString::from(format!("${}s", i));
let tab_file_paths = tab_files.iter()
- .map(|file| file.strip_prefix(&self.cwd)
+ .map(|file|
+ // strip out the cwd part to make path shorter
+ file.strip_prefix(&self.cwd)
.into_os_string()
+ // escape single quotes so file names with them work
.escape_single_quote())
.collect::<Vec<OsString>>();
@@ -105,6 +111,7 @@ impl Cmd {
let tab_path_pat = OsString::from(format!("${}", i));
let tab_path = tab_path.strip_prefix(&self.cwd)
.into_os_string()
+ // escape single quotes so file names with them work
.escape_single_quote();
cmd.iter().map(|part| {