Skip to content

Commit

Permalink
*: Remove redundant return 0's
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed Aug 12, 2016
1 parent 72beabe commit 8611927
Show file tree
Hide file tree
Showing 247 changed files with 1,256 additions and 1,387 deletions.
27 changes: 12 additions & 15 deletions bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ _filedir()
{
local IFS=$'\n'

_tilde "$cur" || return 0
_tilde "$cur" || return

local -a toks
local x tmp
Expand Down Expand Up @@ -778,7 +778,7 @@ __parse_options()
*) break ;;
esac
done
[[ $option ]] || return 0
[[ $option ]] || return

IFS=$' \t\n' # affects parsing of the regexps below...

Expand Down Expand Up @@ -1183,7 +1183,7 @@ _service()
_init_completion || return

# don't complete past 2nd token
[[ $cword -gt 2 ]] && return 0
[[ $cword -gt 2 ]] && return

if [[ $cword -eq 1 && $prev == ?(*/)service ]]; then
_services
Expand Down Expand Up @@ -1438,8 +1438,6 @@ _user_at_host()
else
COMPREPLY=( $( compgen -u -- "$cur" ) )
fi

return 0
}
shopt -u hostcomplete && complete -F _user_at_host -o nospace talk ytalk finger

Expand Down Expand Up @@ -1626,7 +1624,6 @@ _known_hosts_real()

__ltrim_colon_completions "$prefix$user$cur"

return 0
} # _known_hosts_real()
complete -F _known_hosts traceroute traceroute6 tracepath tracepath6 \
fping fping6 telnet rsh rlogin ftp dig mtr ssh-installkeys showmount
Expand All @@ -1647,7 +1644,7 @@ _cd()
# ./ or ../
if [[ -z "${CDPATH:-}" || "$cur" == ?(.)?(.)/* ]]; then
_filedir -d
return 0
return
fi

local -r mark_dirs=$(_rl_enabled mark-directories && echo y)
Expand All @@ -1674,7 +1671,7 @@ _cd()
fi
fi

return 0
return
}
if shopt -q cdable_vars; then
complete -v -F _cd -o nospace cd pushd
Expand Down Expand Up @@ -1812,33 +1809,33 @@ _longopt()

case "${prev,,}" in
--help|--usage|--version)
return 0
return
;;
--*dir*)
_filedir -d
return 0
return
;;
--*file*|--*path*)
_filedir
return 0
return
;;
--+([-a-z0-9_]))
local argtype=$( LC_ALL=C $1 --help 2>&1 | command sed -ne \
"s|.*$prev\[\{0,1\}=[<[]\{0,1\}\([-A-Za-z0-9_]\{1,\}\).*|\1|p" )
case ${argtype,,} in
*dir*)
_filedir -d
return 0
return
;;
*file*|*path*)
_filedir
return 0
return
;;
esac
;;
esac

$split && return 0
$split && return

if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W "$( LC_ALL=C $1 --help 2>&1 | \
Expand All @@ -1865,7 +1862,7 @@ _filedir_xspec()
local cur prev words cword
_init_completion || return

_tilde "$cur" || return 0
_tilde "$cur" || return

local IFS=$'\n' xspec=${_xspecs[${1##*/}]} tmp
local -a toks
Expand Down
5 changes: 2 additions & 3 deletions completions/_chsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ _chsh()

case $prev in
--list-shells|--help|-v|--version)
return 0
return
;;
-s|--shell)
_shells
return 0
return
;;
esac

Expand All @@ -24,7 +24,6 @@ _chsh()
_allowed_users
fi

return 0
} &&
complete -F _chsh chsh

Expand Down
14 changes: 7 additions & 7 deletions completions/_mock
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ _mock()
case $prev in
-h|--help|--copyin|--copyout|--arch|-D|--define|--with|--without|\
--uniqueext|--rpmbuild_timeout|--sources|--cwd)
return 0
return
;;
-r|--root)
COMPREPLY=( $( compgen -W "$( command ls $cfgdir )" -- "$cur" ) )
COMPREPLY=( ${COMPREPLY[@]/%.cfg/} )
return 0
return
;;
--configdir|--resultdir)
_filedir -d
return 0
return
;;
--spec)
_filedir spec
return 0
return
;;
--target)
# Yep, compatible archs, not compatible build archs
Expand All @@ -47,15 +47,15 @@ _mock()
COMPREPLY=( $( compgen -W "$( command rpm --showrc | \
command sed -ne 's/^\s*compatible\s\s*archs\s*:\s*\(.*\)/\1/i p' )" \
-- "$cur" ) )
return 0
return
;;
--enable-plugin|--disable-plugin)
COMPREPLY=( $( compgen -W "$plugins" -- "$cur" ) )
return 0
return
;;
esac

$split && return 0
$split && return

if [[ "$cur" == -* ]] ; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
Expand Down
2 changes: 1 addition & 1 deletion completions/_modules
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ _module ()
;;
esac
fi
return 0

} &&
complete -F _module -o default module

Expand Down
45 changes: 22 additions & 23 deletions completions/_nmcli
Original file line number Diff line number Diff line change
Expand Up @@ -42,35 +42,35 @@ _nmcli()
case $prev in
-m|--mode)
COMPREPLY=( $( compgen -W 'tabular multiline' -- "$cur" ) )
return 0
return
;;
-f|--fields)
COMPREPLY=( $( compgen -W 'all common' -- "$cur" ) )
return 0
return
;;
-e|--escape)
_nmcli_list "yes no"
return 0
return
;;
id)
_nmcli_con_id
return 0
return
;;
uuid)
_nmcli_con_uuid
return 0
return
;;
iface)
_available_interfaces
return 0
return
;;
bssid)
_nmcli_ab_bssid
return 0
return
;;
wep-key-type)
_nmcli_list "key phrase"
return 0
return
;;
esac

Expand All @@ -90,23 +90,23 @@ _nmcli()
case $command in
enable)
_nmcli_list "true false"
return 0
return
;;
sleep)
_nmcli_list "true false"
return 0
return
;;
wifi)
_nmcli_list "on off"
return 0
return
;;
wwan)
_nmcli_list "on off"
return 0
return
;;
wimax)
_nmcli_list "on off"
return 0
return
;;
esac

Expand All @@ -117,7 +117,7 @@ _nmcli()
case $command in
list)
COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) )
return 0
return
;;
up)
if [[ "$cur" == -* ]]; then
Expand All @@ -127,15 +127,15 @@ _nmcli()
COMPREPLY=( $( compgen -W 'id uuid iface ap nsp' \
-- "$cur" ) )
fi
return 0
return
;;
down)
COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) )
return 0
return
;;
delete)
COMPREPLY=( $( compgen -W 'id uuid' -- "$cur" ) )
return 0
return
;;
esac

Expand All @@ -146,7 +146,7 @@ _nmcli()
case $command in
list)
COMPREPLY=( $( compgen -W 'iface' -- "$cur" ) )
return 0
return
;;
disconnect)
if [[ "$cur" == -* ]]; then
Expand All @@ -155,7 +155,7 @@ _nmcli()
else
COMPREPLY=( $( compgen -W 'iface' -- "$cur" ) )
fi
return 0
return
;;
wifi)
local subcommand=${words[3]}
Expand All @@ -164,7 +164,7 @@ _nmcli()
list)
COMPREPLY=( $( compgen -W 'iface bssid' \
-- "$cur" ) )
return 0
return
;;
connect)
if [[ "$cur" == -* ]]; then
Expand All @@ -179,12 +179,12 @@ _nmcli()
-- "$cur" ) )
fi
fi
return 0
return
;;
esac

COMPREPLY=( $( compgen -W 'list connect' -- "$cur" ) )
return 0
return
;;
esac

Expand All @@ -195,7 +195,6 @@ _nmcli()

fi

return 0
} &&
complete -F _nmcli nmcli

Expand Down
2 changes: 1 addition & 1 deletion completions/_repomanage
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ _repomanage()
local cur prev words cword split
_init_completion -s || return

[[ "$prev" == -@([hk]|-help|-keep) ]] && return 0
[[ "$prev" == -@([hk]|-help|-keep) ]] && return

$split && return

Expand Down
4 changes: 2 additions & 2 deletions completions/_reptyr
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ _reptyr()

case $prev in
-l)
return 0
return
;;
esac

if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
return 0
return
fi

[[ $prev != +([0-9]) ]] && _pids
Expand Down
8 changes: 4 additions & 4 deletions completions/_rtcwake
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ _rtcwake()

case "$prev" in
--help|-h|--version|-V|--seconds|-s|--time|-t)
return 0
return
;;
--mode|-m)
COMPREPLY=( $( compgen -W 'standby mem disk on no off' -- "$cur" ) )
return 0
return
;;
--device|-d)
COMPREPLY=( $( command ls -d /dev/rtc?* 2>/dev/null ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]#/dev/}' -- "$cur" ) )
return 0
return
;;
esac

$split && return 0
$split && return

COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
} &&
Expand Down
Loading

0 comments on commit 8611927

Please sign in to comment.