coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ls -l --time-style, configure recent interval


From: Pádraig Brady
Subject: Re: ls -l --time-style, configure recent interval
Date: Sat, 28 Dec 2019 16:15:26 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:70.0) Gecko/20100101 Thunderbird/70.0

On 23/12/2019 01:48, Mike Miller wrote:
Hi,

I'd like to use the --time-style option of ls to make dates more friendly, such
as the Python library humanize does.  This kind of library turns dates in the
last week to something like "2 days ago..." etc.  I use this value which is a
close approximation:

      --time-style='+%Y-%m-%d %k:%M
         %a %k:%M'

This results in something similar to long-iso when distant and a much simpler
version when the file is recent:

      2019-06-05 14:36 file1
             Wed 13:25 file2

I'm happy enough with this format, but the problem is that the decision of what
is recent appears to be hard-coded to be six months.  I'd like to be able to
configure that to be one week instead.

Turns out file2 above was modified in July, haha.  Any chance of getting an
option to tune the "recent interval" parameter?

Often TIME_STYLE is configured in an env var,
so we'd probably have to have a separate var to
config that, which isn't ideal.

I wonder could we auto set the "recent" limit
based on the resolution of the format provided?
I.E. If you specify %a, use a week as the recent threshold?

cheers,
Pádraig



reply via email to

[Prev in Thread] Current Thread [Next in Thread]