lsd icon indicating copy to clipboard operation
lsd copied to clipboard

Use a different time format for recent files

Open manno opened this issue 4 years ago • 1 comments

  • os: Mac
  • lsd --version: 0.20.1
  • echo $TERM: xterm-256color
  • echo $LS_COLORS:

Expected behavior

GNU ls and BSD ls display a different time format for recently modified files. Old files show the year, new files the time.

For GNU ls this is configurable by the TIME_STYLE variable:

The TIME_STYLE argument can be full-iso, long-iso, iso, locale, or +FORMAT. FORMAT is interpreted like in date(1). If FORMAT is FORMAT1FORMAT2, then FORMAT1 applies to non-recent files and FORMAT2 to recent files.

% ls -la                                                                                                    .
total 0
drwxr-xr-x  5 mm staff  160 Sep 26 15:10 .
drwx------ 32 mm staff 1024 Aug  8 13:04 ..
-rw-r--r--  1 mm staff    0 Nov 11  2018 oldfile
-rw-r--r--  1 mm staff    0 Sep 26 15:08 recentfile
% stat oldfile recentfile                                                                       .
  File: oldfile
Access: 2020-11-27 22:05:59.000000000 +0100
Modify: 2018-11-11 16:04:57.000000000 +0100
Change: 2021-09-26 15:10:32.982365307 +0200
 Birth: 2018-11-11 16:04:57.000000000 +0100
  File: recentfile
Access: 2021-09-26 15:08:22.236659000 +0200
Modify: 2021-09-26 15:08:22.236659000 +0200
Change: 2021-09-26 15:08:22.236667905 +0200
 Birth: 2021-09-26 15:08:22.236580024 +0200

Actual behavior

LSD always show the same time format.

% lsd -l                                                                                                    .
.rw-r--r-- mm staff 0 B Sun Nov 11 16:04:57 2018  oldfile
.rw-r--r-- mm staff 0 B Sun Sep 26 15:08:22 2021  recentfile

Is it possible to show the time for recent files and the year for old files?

manno avatar Sep 26 '21 13:09 manno

We currently do not have support for specifying different time format for recent files, but that would be a great addition.

meain avatar Sep 27 '21 05:09 meain