Commit Graph

9 Commits

Author SHA1 Message Date
Benjamin Sago f8df02dae7 Batch source formatting
I read through every file and applied a couple of rustfmt suggestions. The brace placement and alignment of items on similar lines has been made consistent, even if neither are rustfmt's default style (a file has been put in place to enforce this). Other changes are:

• Alphabetical imports and modules
• Comma placement at the end of match blocks
• Use newlines and indentation judiciously
• Spaces around associated types
• Spaces after negations (it makes it more clear imho)
• Comment formatting
• Use early-returns and Optional `?` where appropriate
2020-10-10 20:02:55 +01:00
Thomas Hurst acb7c49abf Improve handling of unavailable timestamps.
Previously if a timestamp was unavailable, it defaulted to the epoch.
Prior to this it defaulted to a zero duration.

Switch to an Option<SystemTime> and move the handling of unavailable
timestamps to rendering.
2020-05-19 02:31:15 +00:00
Thomas Hurst bc830b9158 Handle timestamps before UNIX_EPOCH (#658)
Instead of returning a Duration since the epoch from file metadata,
which cannot represent times before it, return the SystemTime directly.

Move conversion closer to where it's needed, and perform it infallibly.
2020-05-18 21:03:44 +00:00
Bond_009 f599c7ce93 Update to Rust 2018 2019-07-19 20:40:21 +02:00
ariasuni b0da0c9055 Use correct metadata for created time 2019-03-23 17:18:18 +01:00
Benjamin Sago 9b24649d68 Reverse what knows how to render a cell
This commit adds many traits, all named ‘Colours’, to the code. Each one asks for a colour needed to render a cell: the number of links asks for colours for the number and the multi-link-file special case; the file size asks for number, unit, punctuation, and device ID colours, or it can do a scale with its own colours, however it wants.

This is a step towards LS_COLORS compatibility, believe it or not. If a text cell in a column doesn’t depend on Colours to render itself, then the source of the colours is open-ended.

I am glad to have not needed any test changes here.
2017-08-20 20:29:23 +01:00
Benjamin Sago aa5b1867dd Make nanoseconds available to times
The information was always in the Metadata struct; exa just never used it.
2017-07-05 23:08:56 +01:00
Benjamin Sago 652e27e6dd Extract time formatter
This commit collects all the time-related fields from the Environment and bundles them all together in their own encapsulated struct.
2017-07-03 08:45:14 +01:00
Benjamin Sago b5d5509657 Timestamps will need more work 2017-05-22 08:52:45 +01:00