Просмотр исходного кода

feat: Add -o shorcut to --octal-permissions

(exa PR) 1164: Add -o shorcut to --octal-permissions
Christina Sørensen 2 лет назад
Родитель
Сommit
05605e533f
7 измененных файлов с 51 добавлено и 49 удалено
  1. 1 1
      README.md
  2. 5 5
      completions/fish/exa.fish
  3. 1 1
      completions/zsh/_exa
  4. 3 0
      man/exa.1.md
  5. 1 1
      src/options/flags.rs
  6. 19 20
      src/options/help.rs
  7. 21 21
      xtests/outputs/help.ansitxt

+ 1 - 1
README.md

@@ -80,7 +80,7 @@ These options are available when running with `--long` (`-l`):
 - **--git**: list each file’s Git status, if tracked or ignored
 - **--time-style**: how to format timestamps
 - **--no-permissions**: suppress the permissions field
-- **--octal-permissions**: list each file's permission in octal format
+- **-o**, **--octal-permissions**: list each file's permission in octal format
 - **--no-filesize**: suppress the filesize field
 - **--no-user**: suppress the user field
 - **--no-time**: suppress the time field

+ 5 - 5
completions/fish/exa.fish

@@ -80,11 +80,11 @@ complete -c exa        -l 'time-style'    -d "How to format timestamps" -x -a "
     long-iso\t'Display longer ISO timestaps, up to the minute'
     full-iso\t'Display full ISO timestamps, up to the nanosecond'
 "
-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"
-complete -c exa        -l 'no-filesize'    -d "Suppress the filesize field"
-complete -c exa        -l 'no-user'        -d "Suppress the user field"
-complete -c exa        -l 'no-time'        -d "Suppress the time field"
+complete -c exa        -l 'no-permissions'    -d "Suppress the permissions field"
+complete -c exa -s 'o' -l 'octal-permissions' -d "List each file's permission in octal format"
+complete -c exa        -l 'no-filesize'       -d "Suppress the filesize field"
+complete -c exa        -l 'no-user'           -d "Suppress the user field"
+complete -c exa        -l 'no-time'           -d "Suppress the time field"
 
 # Optional extras
 complete -c exa -l 'git' -d "List each file's Git status, if tracked"

+ 1 - 1
completions/zsh/_exa

@@ -45,7 +45,7 @@ __exa() {
         {-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)" \
         --no-permissions"[Suppress the permissions field]" \
-        --octal-permissions"[List each file's permission in octal format]" \
+        {-o, --octal-permissions}"[List each file's permission in octal format]" \
         --no-filesize"[Suppress the filesize field]" \
         --no-user"[Suppress the user field]" \
         --no-time"[Suppress the time field]" \

+ 3 - 0
man/exa.1.md

@@ -168,6 +168,9 @@ These options are available when running with `--long` (`-l`):
 `--no-permissions`
 : Suppress the permissions field.
 
+`-o`, `--octal-permissions`
+: List each file's permissions in octal format.
+
 `--no-filesize`
 : Suppress the file size field.
 

+ 1 - 1
src/options/flags.rs

@@ -66,7 +66,7 @@ pub static GIT:               Arg = Arg { short: None,       long: "git",
 pub static GIT_REPOS:         Arg = Arg { short: None,       long: "git-repos",            takes_value: TakesValue::Forbidden };
 pub static GIT_REPOS_NO_STAT: Arg = Arg { short: None,       long: "git-repos-no-status",  takes_value: TakesValue::Forbidden };
 pub static EXTENDED:          Arg = Arg { short: Some(b'@'), long: "extended",             takes_value: TakesValue::Forbidden };
-pub static OCTAL:             Arg = Arg { short: None,       long: "octal-permissions",    takes_value: TakesValue::Forbidden };
+pub static OCTAL:             Arg = Arg { short: Some(b'o'), long: "octal-permissions",    takes_value: TakesValue::Forbidden };
 pub static SECURITY_CONTEXT:  Arg = Arg { short: Some(b'Z'), long: "context",              takes_value: TakesValue::Forbidden };
 
 

+ 19 - 20
src/options/help.rs

@@ -41,32 +41,31 @@ FILTERING AND SORTING OPTIONS
                              date, time, old, and new all refer to modified.
 
 LONG VIEW OPTIONS
-  -b, --binary         list file sizes with binary prefixes
-  -B, --bytes          list file sizes in bytes, without any prefixes
-  -g, --group          list each file's group
-  -h, --header         add a header row to each column
-  -H, --links          list each file's number of hard links
-  -i, --inode          list each file's inode number
-  -m, --modified       use the modified timestamp field
-  -n, --numeric        list numeric user and group IDs
-  -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
-  --changed            use the changed timestamp field
-  --time-style         how to format timestamps (default, iso, long-iso, full-iso)
-  --no-permissions     suppress the permissions field
-  --octal-permissions  list each file's permission in octal format
-  --no-filesize        suppress the filesize field
-  --no-user            suppress the user field
-  --no-time            suppress the time field";
+  -b, --binary             list file sizes with binary prefixes
+  -B, --bytes              list file sizes in bytes, without any prefixes
+  -g, --group              list each file's group
+  -h, --header             add a header row to each column
+  -H, --links              list each file's number of hard links
+  -i, --inode              list each file's inode number
+  -m, --modified           use the modified timestamp field
+  -n, --numeric            list numeric user and group IDs
+  -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
+  --changed                use the changed timestamp field
+  --time-style             how to format timestamps (default, iso, long-iso, full-iso)
+  --no-permissions         suppress the permissions field
+  -o, --octal-permissions  list each file's permission in octal format
+  --no-filesize            suppress the filesize field
+  --no-user                suppress the user field
+  --no-time                suppress the time field";
 
 static GIT_FILTER_HELP: &str = "  --git-ignore               ignore files mentioned in '.gitignore'";
 static GIT_VIEW_HELP:   &str = "  --git                list each file's Git status, if tracked or ignored";
 static EXTENDED_HELP:   &str = "  -@, --extended       list each file's extended attributes and sizes";
 static SECATTR_HELP:    &str = "  -Z, --context        list each file's security context";
 
-
 /// All the information needed to display the help text, which depends
 /// on which features are enabled and whether the user only wants to
 /// see one section’s help.

+ 21 - 21
xtests/outputs/help.ansitxt

@@ -33,24 +33,24 @@ FILTERING AND SORTING OPTIONS
                              date, time, old, and new all refer to modified.
 
 LONG VIEW OPTIONS
-  -b, --binary         list file sizes with binary prefixes
-  -B, --bytes          list file sizes in bytes, without any prefixes
-  -g, --group          list each file's group
-  -h, --header         add a header row to each column
-  -H, --links          list each file's number of hard links
-  -i, --inode          list each file's inode number
-  -m, --modified       use the modified timestamp field
-  -n, --numeric        list numeric user and group IDs
-  -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
-  --changed            use the changed timestamp field
-  --time-style         how to format timestamps (default, iso, long-iso, full-iso)
-  --no-permissions     suppress the permissions field
-  --octal-permissions  list each file's permission in octal format
-  --no-filesize        suppress the filesize field
-  --no-user            suppress the user field
-  --no-time            suppress the time field
-  --git                list each file's Git status, if tracked or ignored
-  -@, --extended       list each file's extended attributes and sizes
+  -b, --binary             list file sizes with binary prefixes
+  -B, --bytes              list file sizes in bytes, without any prefixes
+  -g, --group              list each file's group
+  -h, --header             add a header row to each column
+  -H, --links              list each file's number of hard links
+  -i, --inode              list each file's inode number
+  -m, --modified           use the modified timestamp field
+  -n, --numeric            list numeric user and group IDs
+  -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
+  --changed                use the changed timestamp field
+  --time-style             how to format timestamps (default, iso, long-iso, full-iso)
+  --no-permissions         suppress the permissions field
+  -o, --octal-permissions  list each file's permission in octal format
+  --no-filesize            suppress the filesize field
+  --no-user                suppress the user field
+  --no-time                suppress the time field
+  --git                    list each file's Git status, if tracked or ignored
+  -@, --extended           list each file's extended attributes and sizes