mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-26 22:21:16 -03:00
Add sort --unique
This commit is contained in:
@@ -21,7 +21,7 @@ Synopsis
|
||||
path resolve GENERAL_OPTIONS [PATH...]
|
||||
path change-extension GENERAL_OPTIONS EXTENSION [PATH...]
|
||||
path sort GENERAL_OPTIONS [(-v | --invert)] \
|
||||
[--what=basename|dirname|path] [([PATH...]
|
||||
[-u | --unique] [--what=basename|dirname|path] [([PATH...]
|
||||
|
||||
GENERAL_OPTIONS := [(-z | --null-in)] [(-Z | --null-out)] [(-q | --quiet)]
|
||||
|
||||
@@ -351,6 +351,8 @@ With ``--invert`` or ``-v`` the sort is reversed.
|
||||
|
||||
With ``--what=`` only the given path of the path is compared, e.g. ``--what=dirname`` causes only the dirname to be compared, ``--what=basename`` only the basename and ``--what=path`` causes the entire path to be compared (this is the default).
|
||||
|
||||
With ``--unique`` or ``-u`` the sort is deduplicated, meaning only the first of a run that have the same key is kept. So if you are sorting by basename, then only the first of each basename is used.
|
||||
|
||||
The sort used is stable, so sorting first by basename and then by dirname works and causes the files to be grouped according to directory.
|
||||
|
||||
It currently returns 0 if it was given any paths.
|
||||
@@ -368,6 +370,10 @@ Examples
|
||||
10-foo
|
||||
2-bar
|
||||
|
||||
>_ path sort --unique --what=basename $fish_function_path/*.fish
|
||||
# prints a list of all function files fish would use, sorted by name.
|
||||
|
||||
|
||||
Combining ``path``
|
||||
-------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user