Parcourir la source

Document --time-style, and completions

Benjamin Sago il y a 8 ans
Parent
commit
6afde85e18
8 fichiers modifiés avec 25 ajouts et 3 suppressions
  1. 2 0
      README.md
  2. 5 0
      contrib/completions.bash
  3. 8 2
      contrib/completions.fish
  4. 1 0
      contrib/completions.zsh
  5. 5 0
      contrib/man/exa.1
  6. 2 1
      src/options/help.rs
  7. 1 0
      xtests/help
  8. 1 0
      xtests/help_long

+ 2 - 0
README.md

@@ -51,10 +51,12 @@ These options are available when running with --long (`-l`):
 - **-U**, **--created**: use the created timestamp field
 - **-@**, **--extended**: list each file's extended attributes and sizes
 - **--git**: list each file's Git status, if tracked
+- **--time-style**: how to format timestamps
 
 - Valid **--color** options are **always**, **automatic**, and **never**.
 - Valid sort fields are **accessed**, **created**, **extension**, **Extension**, **inode**, **modified**, **name**, **Name**, **size**, **type**, and **none**. Fields starting with a capital letter are case-sensitive.
 - Valid time fields are **modified**, **accessed**, and **created**.
+- Valid time styles are **default**, **iso**, **long-iso**, and **full-iso**.
 
 
 ## Installation

+ 5 - 0
contrib/completions.bash

@@ -22,6 +22,11 @@ _exa()
             COMPREPLY=( $( compgen -W 'accessed modified created --' -- $cur ) )
             return
             ;;
+
+        --time-style)
+            COMPREPLY=( $( compgen -W 'default iso long-iso full-iso --' -- $cur ) )
+            return
+            ;;
     esac
 
     case "$cur" in

+ 8 - 2
contrib/completions.fish

@@ -55,8 +55,14 @@ complete -c exa -s 't' -l 'time'  -x -d "Which timestamp field to list" -a "
     created\t'Display created time'
     modified\t'Display modified time'
 "
-complete -c exa -s 'u' -l 'accessed' -d "Use the accessed timestamp field"
-complete -c exa -s 'U' -l 'created'  -d "Use the created timestamp field"
+complete -c exa -s 'u' -l 'accessed'      -d "Use the accessed timestamp field"
+complete -c exa -s 'U' -l 'created'       -d "Use the created timestamp field"
+complete -c exa        -l 'time-style' -x -d "How to format timestamps" -a "
+    default\t'Use the default time style'
+    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'
+"
 
 # Optional extras
 complete -c exa -s 'g' -l 'git'      -d "List each file's Git status, if tracked"

+ 1 - 0
contrib/completions.zsh

@@ -29,6 +29,7 @@ __exa() {
         {-m,--modified}"[Use the modified timestamp field]" \
         {-S,--blocks}"[List each file's number of filesystem blocks]" \
         {-t,--time}"[Which time field to show]:(time field):(accessed created modified)" \
+        --time-style"[How to format timestamps]:(time style):(default iso long-iso full-iso)" \
         {-u,--accessed}"[Use the accessed timestamp field]" \
         {-U,--created}"[Use the created timestamp field]" \
         --git"[List each file's Git status, if tracked]" \

+ 5 - 0
contrib/man/exa.1

@@ -145,6 +145,11 @@ which timestamp field to list (modified, accessed, created)
 .RS
 .RE
 .TP
+.B \-\-time\-style=\f[I]STYLE\f[]
+how to format timestamps (default, iso, long-iso, full-iso)
+.RS
+.RE
+.TP
 .B \-u, \-\-accessed
 use the accessed timestamp field
 .RS

+ 2 - 1
src/options/help.rs

@@ -40,7 +40,8 @@ LONG VIEW OPTIONS
   -S, --blocks       show number of file system blocks
   -t, --time FIELD   which timestamp field to list (modified, accessed, created)
   -u, --accessed     use the accessed timestamp field
-  -U, --created      use the created timestamp field"##;
+  -U, --created      use the created timestamp field
+  --time-style       how to format timestamps (default, iso, long-iso, full-iso)"##;
 
 static GIT_HELP:      &str = r##"  --git              list each file's Git status, if tracked"##;
 static EXTENDED_HELP: &str = r##"  -@, --extended     list each file's extended attributes and sizes"##;

+ 1 - 0
xtests/help

@@ -38,5 +38,6 @@ LONG VIEW OPTIONS
   -t, --time FIELD   which timestamp field to list (modified, accessed, created)
   -u, --accessed     use the accessed timestamp field
   -U, --created      use the created timestamp field
+  --time-style       how to format timestamps (default, iso, long-iso, full-iso)
   --git              list each file's Git status, if tracked
   -@, --extended     list each file's extended attributes and sizes

+ 1 - 0
xtests/help_long

@@ -14,5 +14,6 @@ LONG VIEW OPTIONS
   -t, --time FIELD   which timestamp field to list (modified, accessed, created)
   -u, --accessed     use the accessed timestamp field
   -U, --created      use the created timestamp field
+  --time-style       how to format timestamps (default, iso, long-iso, full-iso)
   --git              list each file's Git status, if tracked
   -@, --extended     list each file's extended attributes and sizes