Use a different time format for recent files
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.2k
- Forks
- 510
- PR merge metrics
- No merged PRs in 30d
Description
- 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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the reported GNU and BSD ls behavior with lsd's current long-list time output. Locate the time-formatting entry point and any related tests, then verify that recent files show a time while older files show a year without changing other listing fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100