diff options
author | Benjamin Sago <ogham@bsago.me> | 2016-04-11 19:10:55 +0100 |
---|---|---|
committer | Benjamin Sago <ogham@bsago.me> | 2016-04-11 19:10:55 +0100 |
commit | 9b87ef1da2231acef985bb08f7bd4a557167b652 (patch) | |
tree | 99f32fb1c4c4dbc206c285faadc31bce96753983 /src/output/lines.rs | |
parent | f35d28d1b8e85b37f5dbca17014f4c0f62fa5c30 (diff) |
Print the parent path for passed-in files
This commit changes all the views to accommodate printing each path's prefix, if it has one.
Previously, each file was stripped of its ancestry, leaving only its file name to be displayed. So running "exa /usr/bin/*" would display only filenames, while running "ls /usr/bin/*" would display each file prefixed with "/usr/bin/". But running "ls /usr/bin/" -- without the glob -- would run ls on just the directory, printing out the file names with no prefix or anything.
This functionality turned out to be useful in quite a few situations: firstly, if the user passes in files from different directories, it would be hard to tell where they came from (especially if they have the same name, such as find | xargs). Secondly, this also applied when following symlinks, making it unclear exactly which file a symlink would be pointing to.
The reason that it did it this way beforehand was that I didn't think of these use-cases, rather than for any technical reason; this new method should not have any drawbacks save making the output slightly wider in a few cases. Compatibility with ls is also a big plus.
Fixes #104, and relates to #88 and #92.
Diffstat (limited to 'src/output/lines.rs')
-rw-r--r-- | src/output/lines.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/output/lines.rs b/src/output/lines.rs index 07c4351..97820cd 100644 --- a/src/output/lines.rs +++ b/src/output/lines.rs @@ -15,7 +15,7 @@ pub struct Lines { impl Lines { pub fn view(&self, files: Vec<File>) { for file in files { - println!("{}", ANSIStrings(&filename(file, &self.colours, true))); + println!("{}", ANSIStrings(&filename(&file, &self.colours, true))); } } } |