1
0
Fork 0
mirror of synced 2024-12-26 07:53:21 -05:00

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:
Eric Nielsen 2020-05-25 14:01:00 -05:00
parent e73285c4d1
commit c0d786229c
No known key found for this signature in database
GPG key ID: 47D1DBFA0765A1FB
4 changed files with 18 additions and 10 deletions

View file

@ -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

View file

@ -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})

View file

@ -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 = ""

View file

@ -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)