mirror of
https://github.com/athityakumar/colorls.git
synced 2024-09-12 05:31:14 +02:00
change time/date format in '+FORMAT'
This commit is contained in:
parent
53f557b78a
commit
90aaa4d0b6
2 changed files with 2 additions and 2 deletions
|
@ -250,7 +250,7 @@ module ColorLS
|
|||
end
|
||||
|
||||
def mtime_info(file_mtime)
|
||||
mtime = @time_style.empty? ? file_mtime.asctime : file_mtime.strftime(@time_style)
|
||||
mtime = @time_style.start_with?('+') ? file_mtime.strftime(@time_style.delete_prefix('+')) : file_mtime.asctime
|
||||
now = Time.now
|
||||
return mtime.colorize(@colors[:hour_old]) if now - file_mtime < 60 * 60
|
||||
return mtime.colorize(@colors[:day_old]) if now - file_mtime < 24 * 60 * 60
|
||||
|
|
|
@ -552,7 +552,7 @@ RSpec.describe ColorLS::Flags do
|
|||
end
|
||||
|
||||
context 'with --time-style option' do
|
||||
let(:args) { ['-l', '--time-style=%y-%m-%d %k:%M', "#{FIXTURES}/a.txt"] }
|
||||
let(:args) { ['-l', '--time-style=+%y-%m-%d %k:%M', "#{FIXTURES}/a.txt"] }
|
||||
|
||||
mtime = File.mtime("#{FIXTURES}/a.txt")
|
||||
|
||||
|
|
Loading…
Reference in a new issue