Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add a time style with better human readability #1202

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: Add a time style with better human readability
niT-Tin committed Jul 27, 2023
commit bde8777196442c090e12b811989818aae6bccdae
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -19,6 +19,8 @@ name = "exa"

[dependencies]
ansi_term = "0.12"
chrono = "0.4.26"
chrono-humanize = "0.2.2"
glob = "0.3"
lazy_static = "1.3"
libc = "0.2"
@@ -32,8 +34,6 @@ term_grid = "0.2.0"
terminal_size = "0.1.16"
unicode-width = "0.1"
zoneinfo_compiled = "0.5.1"
chrono = "0.4.26"
chrono-humanize = "0.2.2"

[target.'cfg(unix)'.dependencies]
users = "0.11"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@ Some of the options accept parameters:
- Valid **--color** options are **always**, **automatic**, and **never**.
- Valid sort fields are **accessed**, **changed**, **created**, **extension**, **Extension**, **inode**, **modified**, **name**, **Name**, **size**, **type**, and **none**. Fields starting with a capital letter sort uppercase before lowercase. The modified field has the aliases **date**, **time**, and **newest**, while its reverse has the aliases **age** and **oldest**.
- Valid time fields are **modified**, **changed**, **accessed**, and **created**.
- Valid time styles are **default**, **iso**, **long-iso**, **full-iso** and **hu**.
- Valid time styles are **default**, **iso**, **long-iso**, **full-iso** and **relative**.


---
2 changes: 1 addition & 1 deletion completions/bash/exa
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ _exa()
;;

--time-style)
COMPREPLY=( $( compgen -W 'default iso long-iso full-iso hu --' -- "$cur" ) )
COMPREPLY=( $( compgen -W 'default iso long-iso full-iso relative --' -- "$cur" ) )
return
;;
esac
2 changes: 1 addition & 1 deletion completions/fish/exa.fish
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ complete -c exa -l 'time-style' -d "How to format timestamps" -x -a "
iso\t'Display brief ISO timestamps'
long-iso\t'Display longer ISO timestaps, up to the minute'
full-iso\t'Display full ISO timestamps, up to the nanosecond'
hu\t'Display more readable date forms for humans'
relative\t'Display more readable date forms for humans'
"
complete -c exa -l 'no-permissions' -d "Suppress the permissions field"
complete -c exa -l 'octal-permissions' -d "List each file's permission in octal format"
2 changes: 1 addition & 1 deletion completions/zsh/_exa
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ __exa() {
{-n,--numeric}"[List numeric user and group IDs.]" \
{-S,--blocks}"[List each file's number of filesystem blocks]" \
{-t,--time}="[Which time field to show]:(time field):(accessed changed created modified)" \
--time-style="[How to format timestamps]:(time style):(default iso long-iso full-iso hu)" \
--time-style="[How to format timestamps]:(time style):(default iso long-iso full-iso relative)" \
--no-permissions"[Suppress the permissions field]" \
--octal-permissions"[List each file's permission in octal format]" \
--no-filesize"[Suppress the filesize field]" \
2 changes: 1 addition & 1 deletion src/options/view.rs
Original file line number Diff line number Diff line change
@@ -266,7 +266,7 @@ impl TimeFormat {
else if &word == "full-iso" {
Ok(Self::FullISO)
}
else if &word == "hu" {
else if &word == "relative" {
Ok(Self::Human)
}
else {
2 changes: 1 addition & 1 deletion xtests/input-options.toml
Original file line number Diff line number Diff line change
@@ -42,7 +42,7 @@ tags = [ 'options' ]
name = "exa displays an error for option that takes the wrong parameter"
shell = "exa -l --time-style=24"
stdout = { empty = true }
stderr = { string = "Option --time-style has no \"24\" setting (choices: default, long-iso, full-iso, iso)" }
stderr = { string = "Option --time-style has no \"24\" setting (choices: default, long-iso, full-iso, iso, relative)" }
status = 3
tags = [ 'options' ]