replace "sort | uniq" with "sort -u" in scripts

This commit is contained in:
Wilke Schwiedop 2016-12-21 01:25:14 +01:00
parent a927efa015
commit e8bed9e038
4 changed files with 8 additions and 8 deletions

View file

@ -4,7 +4,7 @@
function __fish_emerge_print_installed_pkgs --description 'Prints completions for installed packages on the system from /var/db/pkg'
if test -d /var/db/pkg
find /var/db/pkg/ -type d | cut -d'/' -f5-6 | sort | uniq | \
find /var/db/pkg/ -type d | cut -d'/' -f5-6 | sort -u | \
sed 's/-[0-9]\{1,\}\..*$//' | sed -e '/^ *$/d'
return
end
@ -13,7 +13,7 @@ end
function __fish_emerge_print_all_pkgs --description 'Prints completions for all available packages on the system from /usr/portage'
if test -d /usr/portage
find /usr/portage/ -maxdepth 2 -type d | cut -d'/' -f4-5 | \
sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort | uniq | \
sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort -u | \
sed 's/-[0-9]\{1,\}\..*$//' | sed -e '/^ *$/d'
return
end

View file

@ -4,21 +4,21 @@
function __fish_equery_print_installed_pkgs --description 'Prints completions for installed packages on the system from /var/db/pkg'
if test -d /var/db/pkg
find /var/db/pkg/ -type d | cut -d'/' -f5-6 | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//'
find /var/db/pkg/ -type d | cut -d'/' -f5-6 | sort -u | sed 's/-[0-9]\{1,\}\..*$//'
return
end
end
function __fish_equery_print_all_pkgs --description 'Prints completions for all available packages on the system from /usr/portage'
if test -d /usr/portage
find /usr/portage/ -maxdepth 2 -type d | cut -d'/' -f4-5 | sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//'
find /usr/portage/ -maxdepth 2 -type d | cut -d'/' -f4-5 | sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort -u | sed 's/-[0-9]\{1,\}\..*$//'
return
end
end
function __fish_equery_print_all_categories --description 'Prints completions for all available categories on the system from /usr/portage'
if test -d /usr/portage
find /usr/portage/ -maxdepth 1 -type d | cut -d'/' -f4 | sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort | uniq | sed 's/-[0-9]\{1,\}\..*$//'
find /usr/portage/ -maxdepth 1 -type d | cut -d'/' -f4 | sed 's/^\(distfiles\|profiles\|eclass\).*$//' | sort -u | sed 's/-[0-9]\{1,\}\..*$//'
return
end
end

View file

@ -2,7 +2,7 @@ begin
set -l unicode 'commandline | __fish_sgrep -qe "-[a-zA-Z]*C[a-zA-Z]*\$"'
set -l noopt 'commandline | not __fish_sgrep -qe "-[a-zA-Z]*C[a-zA-Z]*\$"'
set -l modules "(find (perl -lE'print for @INC') -name '*.pm' -printf '%P\n' ^/dev/null \
| awk '{ gsub(\"/\", \"::\") } /[^-.]/' RS='\\\\\\\\.pm'\n | sort | uniq)"
| awk '{ gsub(\"/\", \"::\") } /[^-.]/' RS='\\\\\\\\.pm'\n | sort -u)"
complete -c perl -s 0 -n $noopt --description 'Specify record separator'
complete -c perl -s a -n $noopt --description 'Turn on autosplit mode'
complete -c perl -s c -n $noopt --description 'Check syntax'

View file

@ -126,7 +126,7 @@ function __fish_svn_prompt --description "Prompt function for svn"
if [ (count $column_status) -ne 0 ]
# we only want to display unique status flags (eg: if there are 5 modified files, the prompt should only show the modified status once)
set -l column_unique_status (echo $column_status | sort | uniq)
set -l column_unique_status (echo $column_status | sort -u)
# parse the status flags for this column and create the formatting by calling out to the helper function
set -l svn_status_flags (__fish_svn_prompt_parse_status $column_unique_status)
@ -146,4 +146,4 @@ function __fish_svn_prompt --description "Prompt function for svn"
# print the close of the svn status prompt
printf ')'
end
end