exa icon indicating copy to clipboard operation
exa copied to clipboard

Make `-t` work like ls when used with no args

Open WhyNotHugo opened this issue 2 years ago • 3 comments

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: https://github.com/ogham/exa/issues/519

WhyNotHugo avatar Aug 09 '22 20:08 WhyNotHugo

This isn't in a ready-to-merge state:

  • ~~Formatting needs to be fixed, but running rust fmt will mess up all the existing formatting which I'm sure would be unacceptable.~~ I think the formatting is okay and matches the rest of the code.
  • There are no tests. After reading all the work put into test, I'm pretty sure that's mandatory for merging.

However, I'm presenting this here early mostly to hear feedback on the approach. I can't decide if this is a beautiful fix, a horrible hack, or somehow, both at the same time.

WhyNotHugo avatar Aug 09 '22 20:08 WhyNotHugo

Oh, I'm not sure what should be done when --sort is passed and -t with no value is passed; it seems one would be redundant.

WhyNotHugo avatar Aug 09 '22 20:08 WhyNotHugo

@ariasuni Any feedback for me here?

WhyNotHugo avatar Sep 05 '22 08:09 WhyNotHugo