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

Make -t without arguments behave like in ls #519

Open
heptal opened this issue Jul 10, 2019 · 9 comments · May be fixed by #1102
Open

Make -t without arguments behave like in ls #519

heptal opened this issue Jul 10, 2019 · 9 comments · May be fixed by #1102

Comments

@heptal
Copy link

heptal commented Jul 10, 2019

This -t thing really is a problem, it's flow-breaking and existing ls-based alias-breaking. It's basically infuriating because everything else works so well. Even an env variable I could set would be great.

Flag -t needs a value (choices: modified, accessed, created)
To sort newest files last, try "--sort newest", or just "-snew"

#294 (comment)
#284 (comment)

@varenc
Copy link

varenc commented Oct 12, 2019

agreed 100% on this. I love exa! But the lack of -t really breaks my flow. Whenever this happens, I find myself consistently using \ls -ltr to get around my ls=exa alias. The -snew option is nice, but longer to type and I find multiple character single dash options a bit confusing. (it looks like each character is its own seperate option). The helpful error message also makes it clear exa knows what I'm trying to do.

For now, I've set up a little function that ls maps to. Usually, this function just runs exa directly, but it also checks if the args contain a single dash t option and if they do it removes t and adds -snew to the args passed to exa. It's quite hacky and bugs out sometimes, but it is generally what I want. I like this comment which suggests a --legacy option to enable more ls compliant behavior like this.

@RandomErrorMessage
Copy link

Check out LSD for a similar tool that is actually a drop-in replacement for LS.

@rxw1
Copy link

rxw1 commented Oct 16, 2019

Check out LSD for a similar tool that is actually a drop-in replacement for LS.

+1, LSD is really great. Highly recommended.

@madebyollin
Copy link

Since I prefer exa to lsd apart from this particular bit of broken muscle memory...

ls() {
    if [ "$1" = "-ltr" ]; then
        exa -lsnew "${@:2}"
    elif [ "$1" = "-lrt" ]; then
        exa -lsnew "${@:2}"
    else
        exa "$@"
    fi
}

(In .profile, .bashrc, whatever, instead of the usual alias ls=exa)

@kaushalyap
Copy link

kaushalyap commented Mar 24, 2020

@ogham @nwin Any plans to fix this ?

@ariasuni ariasuni changed the title -t Make -t without arguments behave like in ls Apr 5, 2021
@ariasuni
Copy link
Collaborator

ariasuni commented Apr 5, 2021

Latest version of exa adds support for optional argument for flags, so it will be possible to change -t into a valid flag on its own that behaves like in ls. I’m not sure if there’s any objection from the author for this specific behavior, though.

Edit: one important note is that in ls, -t (controls sorting) and --time (controls displayed time) do something very different.

@ahcm
Copy link

ahcm commented Sep 1, 2021

Basically have the same experience, as varenc writes.

@ariasuni ariasuni mentioned this issue Jul 18, 2022
WhyNotHugo added a commit to WhyNotHugo/exa that referenced this issue Aug 9, 2022
Currently `exa` can't work as a drop-in `ls` replacement due to `-t`
having a very different behaviour.

However `-t` currently only work when used with a value, and is invalid
when used without any value.

This patch changes the behaviour of `-t` when used with no arguments to
behave exactly like it does for `ls`. When used with a value, it
continues behaving as in previous versions of `exa`.

Fixes: ogham#519
@WhyNotHugo WhyNotHugo linked a pull request Aug 9, 2022 that will close this issue
@WhyNotHugo
Copy link

I've taken a shot at this: #1102

Seems to work, but PR still needs work.

WhyNotHugo added a commit to WhyNotHugo/exa that referenced this issue Aug 9, 2022
Currently exa can't work as a drop-in `ls` replacement due to `-t`
having a very different behaviour.

However `-t` currently only works when used with a value, and is invalid
when used without any value.

This patch changes the behaviour of exa when `-t` is passed with no
value to behave the same as ls. When used with a value, it continues
behaving as in previous versions of `exa`.

Fixes: ogham#519
WhyNotHugo added a commit to WhyNotHugo/exa that referenced this issue Aug 9, 2022
Currently exa can't work as a drop-in `ls` replacement due to `-t`
having a very different behaviour.

However `-t` currently only works when used with a value, and is invalid
when used without any value.

This patch changes the behaviour of exa when `-t` is passed with no
value to behave the same as ls. When used with a value, it continues
behaving as in previous versions of `exa`.

Fixes: ogham#519
@eggbean
Copy link

eggbean commented Sep 29, 2022

This wrapper script is a solution for anybody that it still concerned about this. It makes exa behave like ls as close as possible.

https://gist.github.com/eggbean/74db77c4f6404dd1f975bd6f048b86f8

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

Successfully merging a pull request may close this issue.

10 participants