diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f0057e..579dc2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/stage2/30_zmodule.zsh.erb b/src/stage2/30_zmodule.zsh.erb index 0ee721b..e090498 100644 --- a/src/stage2/30_zmodule.zsh.erb +++ b/src/stage2/30_zmodule.zsh.erb @@ -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}) diff --git a/src/zimfw.zsh.erb b/src/zimfw.zsh.erb index 2058ff5..fd8cf19 100644 --- a/src/zimfw.zsh.erb +++ b/src/zimfw.zsh.erb @@ -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 = "" diff --git a/zimfw.zsh b/zimfw.zsh index edc619b..c667361 100644 --- a/zimfw.zsh +++ b/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)