Merge pull request #1645 from cornfeedhobo/cnf-optional-message
_command_exists - custom log messagepull/1651/head
commit
45ae15139d
|
|
@ -19,9 +19,11 @@ function _command_exists ()
|
||||||
{
|
{
|
||||||
_about 'checks for existence of a command'
|
_about 'checks for existence of a command'
|
||||||
_param '1: command to check'
|
_param '1: command to check'
|
||||||
|
_param '2: (optional) log message to include when command not found'
|
||||||
_example '$ _command_exists ls && echo exists'
|
_example '$ _command_exists ls && echo exists'
|
||||||
_group 'lib'
|
_group 'lib'
|
||||||
type "$1" &> /dev/null || (_log_warning "Command $1 does not exist!" && return 1) ;
|
local msg="${2:-Command '$1' does not exist!}"
|
||||||
|
type "$1" &> /dev/null || (_log_warning "$msg" && return 1) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _make_reload_alias() {
|
function _make_reload_alias() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue