Warning when no initialization found in a module
Some plugins don't follow the `module_name.plugin.zsh` name, as "it is the wild west out there". Fixes #395
This commit is contained in:
parent
e73285c4d1
commit
c0d786229c
4 changed files with 18 additions and 10 deletions
|
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Fixed
|
||||
- "No such file or directory" displayed when building a new file. This was a
|
||||
regression introduced after replacing `cmp` by `cksum`.
|
||||
- Show warning message when nothing found to be initialized in a module.
|
||||
|
||||
## [1.2.0] - 2020-05-17
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ Initialization options:
|
|||
return 1
|
||||
fi
|
||||
if (( ! # )); then
|
||||
print -u2 -PR "%F{red}<%= error %>${funcfiletrace[1]}: Missing zmodule url%f"
|
||||
print -u2 -PR "%F{red}<%= error %>${funcfiletrace[1]}: Missing zmodule url%f"$'\n\n'${zusage}
|
||||
_zfailed=1
|
||||
return 1
|
||||
fi
|
||||
|
@ -52,7 +52,7 @@ Initialization options:
|
|||
shift
|
||||
if [[ ${1} == (-n|--name) ]]; then
|
||||
if (( # < 2 )); then
|
||||
print -u2 -PR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option ${1}%f"
|
||||
print -u2 -PR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option ${1}%f"$'\n\n'${zusage}
|
||||
_zfailed=1
|
||||
return 1
|
||||
fi
|
||||
|
@ -65,7 +65,7 @@ Initialization options:
|
|||
case ${1} in
|
||||
-b|--branch|-t|--tag|-f|--fpath|-a|--autoload|-s|--source)
|
||||
if (( # < 2 )); then
|
||||
print -u2 -PR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option ${1}%f"
|
||||
print -u2 -PR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option ${1}%f"$'\n\n'${zusage}
|
||||
_zfailed=1
|
||||
return 1
|
||||
fi
|
||||
|
@ -101,7 +101,7 @@ Initialization options:
|
|||
;;
|
||||
-d|--disabled) zdisabled=1 ;;
|
||||
*)
|
||||
print -u2 -PR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Unknown zmodule option ${1}%f"
|
||||
print -u2 -PR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Unknown zmodule option ${1}%f"$'\n\n'${zusage}
|
||||
_zfailed=1
|
||||
return 1
|
||||
;;
|
||||
|
@ -130,6 +130,9 @@ Initialization options:
|
|||
if (( ! ${#zscripts} )); then
|
||||
zscripts+=(${zdir}/(init.zsh|${zmodule:t}.(zsh|plugin.zsh|zsh-theme|sh))(NOL[1]))
|
||||
fi
|
||||
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zscripts} )); then
|
||||
print -u2 -PR "%F{yellow}<%= warn %>${funcfiletrace[1]}:%B${zmodule}:%b Nothing found to be initialized. Customize the module name or initialization with %Bzmodule%b options.%f"$'\n\n'${zusage}
|
||||
fi
|
||||
_zfpaths+=(${zfpaths})
|
||||
_zfunctions+=(${zfunctions})
|
||||
_zscripts+=(${zscripts})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<%
|
||||
class Zim
|
||||
attr_reader :home, :min_zsh_version, :startup_files_glob, :version, :ellipsis, :okay, :error, :done, :failed
|
||||
attr_reader :home, :min_zsh_version, :startup_files_glob, :version, :ellipsis, :okay, :warn, :error, :done, :failed
|
||||
|
||||
def initialize
|
||||
@home = "${ZDOTDIR:-${HOME}}"
|
||||
|
@ -9,6 +9,7 @@ class Zim
|
|||
@version = "1.2.1-SNAPSHOT"
|
||||
@ellipsis = " ..."
|
||||
@okay = "%F{green})%f "
|
||||
@warn = "! "
|
||||
@error = "x "
|
||||
@done = ""
|
||||
@failed = ""
|
||||
|
|
13
zimfw.zsh
13
zimfw.zsh
|
@ -132,7 +132,7 @@ Initialization options:
|
|||
return 1
|
||||
fi
|
||||
if (( ! # )); then
|
||||
print -u2 -PR "%F{red}x ${funcfiletrace[1]}: Missing zmodule url%f"
|
||||
print -u2 -PR "%F{red}x ${funcfiletrace[1]}: Missing zmodule url%f"$'\n\n'${zusage}
|
||||
_zfailed=1
|
||||
return 1
|
||||
fi
|
||||
|
@ -154,7 +154,7 @@ Initialization options:
|
|||
shift
|
||||
if [[ ${1} == (-n|--name) ]]; then
|
||||
if (( # < 2 )); then
|
||||
print -u2 -PR "%F{red}x ${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option ${1}%f"
|
||||
print -u2 -PR "%F{red}x ${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option ${1}%f"$'\n\n'${zusage}
|
||||
_zfailed=1
|
||||
return 1
|
||||
fi
|
||||
|
@ -167,7 +167,7 @@ Initialization options:
|
|||
case ${1} in
|
||||
-b|--branch|-t|--tag|-f|--fpath|-a|--autoload|-s|--source)
|
||||
if (( # < 2 )); then
|
||||
print -u2 -PR "%F{red}x ${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option ${1}%f"
|
||||
print -u2 -PR "%F{red}x ${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option ${1}%f"$'\n\n'${zusage}
|
||||
_zfailed=1
|
||||
return 1
|
||||
fi
|
||||
|
@ -203,7 +203,7 @@ Initialization options:
|
|||
;;
|
||||
-d|--disabled) zdisabled=1 ;;
|
||||
*)
|
||||
print -u2 -PR "%F{red}x ${funcfiletrace[1]}:%B${zmodule}:%b Unknown zmodule option ${1}%f"
|
||||
print -u2 -PR "%F{red}x ${funcfiletrace[1]}:%B${zmodule}:%b Unknown zmodule option ${1}%f"$'\n\n'${zusage}
|
||||
_zfailed=1
|
||||
return 1
|
||||
;;
|
||||
|
@ -232,6 +232,9 @@ Initialization options:
|
|||
if (( ! ${#zscripts} )); then
|
||||
zscripts+=(${zdir}/(init.zsh|${zmodule:t}.(zsh|plugin.zsh|zsh-theme|sh))(NOL[1]))
|
||||
fi
|
||||
if (( ! ${#zfpaths} && ! ${#zfunctions} && ! ${#zscripts} )); then
|
||||
print -u2 -PR "%F{yellow}! ${funcfiletrace[1]}:%B${zmodule}:%b Nothing found to be initialized. Customize the module name or initialization with %Bzmodule%b options.%f"$'\n\n'${zusage}
|
||||
fi
|
||||
_zfpaths+=(${zfpaths})
|
||||
_zfunctions+=(${zfunctions})
|
||||
_zscripts+=(${zscripts})
|
||||
|
@ -296,7 +299,7 @@ _zimfw_compile() {
|
|||
}
|
||||
|
||||
_zimfw_info() {
|
||||
print -R 'zimfw version: '${_zversion}' (previous commit is 853e5a7)'
|
||||
print -R 'zimfw version: '${_zversion}' (previous commit is e73285c)'
|
||||
print -R 'ZIM_HOME: '${ZIM_HOME}
|
||||
print -R 'Zsh version: '${ZSH_VERSION}
|
||||
print -R 'System info: '$(command uname -a)
|
||||
|
|
Loading…
Reference in a new issue