Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit basename() on paths #88

Closed
jbeich opened this issue Dec 13, 2015 · 1 comment
Closed

Implicit basename() on paths #88

jbeich opened this issue Dec 13, 2015 · 1 comment
Assignees
Milestone

Comments

@jbeich
Copy link
Contributor

jbeich commented Dec 13, 2015

When using glob expansion with multiple files it becomes confusing if exa lists just path tails when absolute or relative one was given on command line. According to POSIX "if the pathname was specified as a file operand, it shall be written as specified."

$ exa /usr/include/stdio.h
stdio.h
$ gnuls /usr/include/stdio.h
/usr/include/stdio.h

$ cd /path/to/mozilla-central

$ exa memory/*/moz.build
moz.build  moz.build  moz.build  moz.build  moz.build  moz.build  moz.build

$ gnuls memory/*/moz.build
memory/build/moz.build     memory/mozalloc/moz.build     memory/volatile/moz.build
memory/fallible/moz.build  memory/mozjemalloc/moz.build
memory/jemalloc/moz.build  memory/replace/moz.build

zsh$ exa **/*.rs
hello.rs  MP4Metadata.rs  mod.rs  new.rs  capi.rs

zsh$ gnuls **/*.rs
dom/media/gtest/hello.rs
media/libstagefright/binding/MP4Metadata.rs
media/libstagefright/binding/byteorder/mod.rs
media/libstagefright/binding/byteorder/new.rs
media/libstagefright/binding/capi.rs
@ogham ogham self-assigned this Dec 15, 2015
@ogham ogham modified the milestones: v0.4.0, v0.5.0 Mar 18, 2016
ogham added a commit that referenced this issue Apr 11, 2016
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.
@ogham
Copy link
Owner

ogham commented Apr 18, 2016

I believe that 9b87ef1 has fixed this.

@ogham ogham closed this as completed Apr 18, 2016
sbatial pushed a commit to syphar/zetta that referenced this issue Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants