From e8bed9e0387af31a276321e38afcbf9b8ec6311a Mon Sep 17 00:00:00 2001 From: Wilke Schwiedop Date: Wed, 21 Dec 2016 01:25:14 +0100 Subject: [PATCH] replace "sort | uniq" with "sort -u" in scripts --- share/completions/emerge.fish | 4 ++-- share/completions/equery.fish | 6 +++--- share/completions/perl.fish | 2 +- share/functions/__fish_svn_prompt.fish | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/share/completions/emerge.fish b/share/completions/emerge.fish index e234be15f..589e41359 100644 --- a/share/completions/emerge.fish +++ b/share/completions/emerge.fish @@ -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 diff --git a/share/completions/equery.fish b/share/completions/equery.fish index 01d9cc157..3ff8ca620 100644 --- a/share/completions/equery.fish +++ b/share/completions/equery.fish @@ -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 diff --git a/share/completions/perl.fish b/share/completions/perl.fish index 284dc4ef1..620261e52 100644 --- a/share/completions/perl.fish +++ b/share/completions/perl.fish @@ -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' diff --git a/share/functions/__fish_svn_prompt.fish b/share/functions/__fish_svn_prompt.fish index a201f4542..243c02285 100644 --- a/share/functions/__fish_svn_prompt.fish +++ b/share/functions/__fish_svn_prompt.fish @@ -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 \ No newline at end of file +end