Refactor "{type => _omb_util_command_exists}"
This commit is contained in:
parent
de66a70f91
commit
2202aeeb04
@ -39,7 +39,7 @@ __docker_compose_to_extglob() {
|
||||
# suppress trailing whitespace
|
||||
__docker_compose_nospace() {
|
||||
# compopt is not available in ancient bash versions
|
||||
type compopt &>/dev/null && compopt -o nospace
|
||||
_omb_util_command_exists compopt && compopt -o nospace
|
||||
}
|
||||
|
||||
# Extracts all service names from the compose file.
|
||||
|
@ -406,7 +406,7 @@ __docker_subcommands() {
|
||||
# suppress trailing whitespace
|
||||
__docker_nospace() {
|
||||
# compopt is not available in ancient bash versions
|
||||
type compopt &>/dev/null && compopt -o nospace
|
||||
_omb_util_command_exists compopt && compopt -o nospace
|
||||
}
|
||||
|
||||
__docker_complete_resolved_hostname() {
|
||||
|
@ -124,7 +124,7 @@ zipf () { zip -r "$1".zip "$1" ; } # zipf: To create a ZIP arc
|
||||
# mkiso: creates iso from current dir in the parent dir (unless defined)
|
||||
# ---------------------------------------------------------
|
||||
mkiso () {
|
||||
if type "mkisofs" > /dev/null; then
|
||||
if _omb_util_command_exists mkisofs; then
|
||||
if [ -z ${1+x} ]; then
|
||||
local isoname=${PWD##*/}
|
||||
else
|
||||
|
@ -403,7 +403,7 @@ _omb_util_alias() {
|
||||
|
||||
function _omb_util_mktemp {
|
||||
local template=tmp.oh-my-bash.XXXXXXXXXX
|
||||
if type -t mktemp &>/dev/null; then
|
||||
if _omb_util_command_exists mktemp; then
|
||||
mktemp -t "$template"
|
||||
else
|
||||
m4 -D template="${TMPDIR:-/tmp}/$template" <<< 'mkstemp(template)'
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
# Try to load nvm only if command not already available
|
||||
if ! type "nvm" &> /dev/null; then
|
||||
if ! _omb_util_command_exists nvm; then
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
# This is done as part of completions!!!
|
||||
# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
|
||||
|
Loading…
Reference in New Issue
Block a user