From de685e8ef3846bc69847bf5281fcb7adb8ad096c Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Mon, 15 Nov 2021 19:37:40 -0500 Subject: [PATCH] Minor text updates in warnings, errors, and usages --- README.md | 16 ++++++++-------- src/stage2/30_zmodule.zsh.erb | 10 +++++----- src/stage2/80_zimfw.zsh.erb | 7 +++---- src/tools/degit.zsh.erb | 2 +- src/tools/git.zsh.erb | 9 +++++++-- zimfw.zsh | 30 +++++++++++++++++------------- 6 files changed, 41 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 26dbb33..61bc539 100644 --- a/README.md +++ b/README.md @@ -39,13 +39,13 @@ Installation ------------ Installing Zim is easy: - * With curl: +* With curl: - curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh + curl -fsSL https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh - * With wget: +* With wget: - wget -nv -O - https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh + wget -nv -O - https://raw.githubusercontent.com/zimfw/install/master/install.zsh | zsh Open a new terminal and you're done. Enjoy your Zsh IMproved! Take some time to tweak your `~/.zshrc` file, and to also check the available [modules] and [themes] @@ -61,14 +61,14 @@ you can add to your `~/.zimrc`. chsh -s $(which zsh) 2. Prepend the lines in the following templates to the respective dot files: + * [~/.zshenv](https://raw.githubusercontent.com/zimfw/install/master/src/templates/zshenv) * [~/.zshrc](https://raw.githubusercontent.com/zimfw/install/master/src/templates/zshrc) * [~/.zlogin](https://raw.githubusercontent.com/zimfw/install/master/src/templates/zlogin) * [~/.zimrc](https://raw.githubusercontent.com/zimfw/install/master/src/templates/zimrc) -3. Restart your terminal to automatically install the modules defined in `~/.zimrc` - and build the initialization scripts. - +3. Restart your terminal to automatically install the `zimfw` command line utility, + install the modules defined in `~/.zimrc`, and build the initialization scripts. Usage @@ -128,7 +128,7 @@ Initialization options: -f|--fpath <path> Add specified path to fpath. The path is relative to the module root directory. Default: functions, if the subdirectory exists. -a|--autoload <func_name> Autoload specified function. Default: all valid names inside the - module's specified fpath paths. + functions subdirectory, if any. -s|--source <file_path> Source specified file. The file path is relative to the module root directory. Default: init.zsh, if the functions subdirectory also exists, or the file with largest size and with name matching diff --git a/src/stage2/30_zmodule.zsh.erb b/src/stage2/30_zmodule.zsh.erb index f47f9db..533fa3c 100644 --- a/src/stage2/30_zmodule.zsh.erb +++ b/src/stage2/30_zmodule.zsh.erb @@ -28,7 +28,7 @@ Initialization options: %B-f%b|%B--fpath%b Add specified path to fpath. The path is relative to the module root directory. Default: %Bfunctions%b, if the subdirectory exists. %B-a%b|%B--autoload%b Autoload specified function. Default: all valid names inside the - module's specified fpath paths. + %Bfunctions%b subdirectory, if any. %B-s%b|%B--source%b Source specified file. The file path is relative to the module root directory. Default: %Binit.zsh%b, if the %Bfunctions%b subdirectory also exists, or the file with largest size and with name matching @@ -67,7 +67,7 @@ Initialization options: shift if [[ ${1} == (-n|--name) ]]; then if (( # < 2 )); then - print -u2 -PlR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option ${1}%f" '' ${zusage} + print -u2 -PlR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option %B${1}%b%f" '' ${zusage} _zfailed=1 return 2 fi @@ -85,7 +85,7 @@ Initialization options: case ${1} in -b|--branch|-t|--tag|-u|--use|-f|--fpath|-a|--autoload|-s|--source|-c|--cmd) if (( # < 2 )); then - print -u2 -PlR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option ${1}%f" '' ${zusage} + print -u2 -PlR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option %B${1}%b%f" '' ${zusage} _zfailed=1 return 2 fi @@ -93,7 +93,7 @@ Initialization options: esac case ${1} in -b|--branch|-t|--tag|-u|--use) - if [[ -z ${zurl} ]] _zimfw_print -u2 -PR "%F{yellow}<%= warn %>${funcfiletrace[1]}:%B${zmodule}:%b The zmodule option ${1} has no effect for external modules%f" + if [[ -z ${zurl} ]] _zimfw_print -u2 -PR "%F{yellow}<%= warn %>${funcfiletrace[1]}:%B${zmodule}:%b The zmodule option %B${1}%b has no effect for external modules%f" ;; esac case ${1} in @@ -134,7 +134,7 @@ Initialization options: ;; -d|--disabled) zdisabled=1 ;; *) - print -u2 -PlR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Unknown zmodule option ${1}%f" '' ${zusage} + print -u2 -PlR "%F{red}<%= error %>${funcfiletrace[1]}:%B${zmodule}:%b Unknown zmodule option %B${1}%b%f" '' ${zusage} _zfailed=1 return 2 ;; diff --git a/src/stage2/80_zimfw.zsh.erb b/src/stage2/80_zimfw.zsh.erb index e37f9e8..7f196ac 100644 --- a/src/stage2/80_zimfw.zsh.erb +++ b/src/stage2/80_zimfw.zsh.erb @@ -14,10 +14,9 @@ Actions: Use %B-v%b to also see the modules details. %Binstall%b Install new modules. Also does %Bbuild%b and %Bcompile%b. Use %B-v%b to also see their output, and see skipped modules. - %Buninstall%b Delete unused modules. Prompts for confirmation. Use option %B-q%b to uninstall - quietly. - %Bupdate%b Update current modules. Also does %Bbuild%b and %Bcompile%b. Use %B-v%b to see their - output, and see skipped modules. + %Buninstall%b Delete unused modules. Prompts for confirmation. Use %B-q%b for quiet uninstall. + %Bupdate%b Update current modules. Also does %Bbuild%b and %Bcompile%b. Use %B-v%b to also see + their output, and see skipped modules. %Bupgrade%b Upgrade zimfw. Also does %Bcompile%b. Use %B-v%b to also see its output. %Bversion%b Print zimfw version. diff --git a/src/tools/degit.zsh.erb b/src/tools/degit.zsh.erb index 9272ca3..3fd861b 100644 --- a/src/tools/degit.zsh.erb +++ b/src/tools/degit.zsh.erb @@ -111,7 +111,7 @@ case ${ACTION} in update) if [[ ! -r ${INFO_TARGET} ]]; then if (( PRINTLEVEL > 0 )); then - print -u2 -PR <%= clear_line %>"%F{yellow}<%= warn %>%B${MODULE}:%b Module was not installed using Zim's degit. Will not try to update. You can disable this with the zmodule option -z|--frozen.%f" + print -u2 -PR <%= clear_line %>"%F{yellow}<%= warn %>%B${MODULE}:%b Module was not installed using Zim's degit. Will not try to update. Use zmodule option %B-z%b|%B--frozen%b to disable this warning.%f" fi return 0 fi diff --git a/src/tools/git.zsh.erb b/src/tools/git.zsh.erb index 2c13321..cf5cb81 100644 --- a/src/tools/git.zsh.erb +++ b/src/tools/git.zsh.erb @@ -23,7 +23,7 @@ case ${ACTION} in update) if [[ ! -r ${DIR}/.git ]]; then if (( PRINTLEVEL > 0 )); then - print -u2 -PR <%= clear_line %>"%F{yellow}<%= warn %>%B${MODULE}:%b Module was not installed using git. Will not try to update. You can disable this with the zmodule option -z|--frozen.%f" + print -u2 -PR <%= clear_line %>"%F{yellow}<%= warn %>%B${MODULE}:%b Module was not installed using git. Will not try to update. Use zmodule option %B-z%b|%B--frozen%b to disable this warning.%f" fi return 0 fi @@ -46,7 +46,12 @@ case ${ACTION} in print_error 'Error during git remote set-head' ${ERR} return 1 fi - REV=${$(command git -C ${DIR} symbolic-ref --short refs/remotes/origin/HEAD)#origin/} || return 1 + if REV=$(command git -C ${DIR} symbolic-ref --short refs/remotes/origin/HEAD 2>&1); then + REV=${REV#origin/} + else + print_error 'Error during git symbolic-ref' ${REV} + return 1 + fi fi if [[ ${TYPE} == branch ]]; then LOG_REV=${REV}@{u} diff --git a/zimfw.zsh b/zimfw.zsh index 068cdcf..8bb77a4 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -138,7 +138,7 @@ Initialization options: %B-f%b|%B--fpath%b Add specified path to fpath. The path is relative to the module root directory. Default: %Bfunctions%b, if the subdirectory exists. %B-a%b|%B--autoload%b Autoload specified function. Default: all valid names inside the - module's specified fpath paths. + %Bfunctions%b subdirectory, if any. %B-s%b|%B--source%b Source specified file. The file path is relative to the module root directory. Default: %Binit.zsh%b, if the %Bfunctions%b subdirectory also exists, or the file with largest size and with name matching @@ -177,7 +177,7 @@ Initialization options: shift if [[ ${1} == (-n|--name) ]]; then if (( # < 2 )); then - print -u2 -PlR "%F{red}x ${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option ${1}%f" '' ${zusage} + print -u2 -PlR "%F{red}x ${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option %B${1}%b%f" '' ${zusage} _zfailed=1 return 2 fi @@ -195,7 +195,7 @@ Initialization options: case ${1} in -b|--branch|-t|--tag|-u|--use|-f|--fpath|-a|--autoload|-s|--source|-c|--cmd) if (( # < 2 )); then - print -u2 -PlR "%F{red}x ${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option ${1}%f" '' ${zusage} + print -u2 -PlR "%F{red}x ${funcfiletrace[1]}:%B${zmodule}:%b Missing argument for zmodule option %B${1}%b%f" '' ${zusage} _zfailed=1 return 2 fi @@ -203,7 +203,7 @@ Initialization options: esac case ${1} in -b|--branch|-t|--tag|-u|--use) - if [[ -z ${zurl} ]] _zimfw_print -u2 -PR "%F{yellow}! ${funcfiletrace[1]}:%B${zmodule}:%b The zmodule option ${1} has no effect for external modules%f" + if [[ -z ${zurl} ]] _zimfw_print -u2 -PR "%F{yellow}! ${funcfiletrace[1]}:%B${zmodule}:%b The zmodule option %B${1}%b has no effect for external modules%f" ;; esac case ${1} in @@ -244,7 +244,7 @@ Initialization options: ;; -d|--disabled) zdisabled=1 ;; *) - print -u2 -PlR "%F{red}x ${funcfiletrace[1]}:%B${zmodule}:%b Unknown zmodule option ${1}%f" '' ${zusage} + print -u2 -PlR "%F{red}x ${funcfiletrace[1]}:%B${zmodule}:%b Unknown zmodule option %B${1}%b%f" '' ${zusage} _zfailed=1 return 2 ;; @@ -373,7 +373,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at 2021-11-11 18:43:25 UTC, previous commit is cd71c8d)' + print -R 'zimfw version: '${_zversion}' (built at 2021-11-15 16:43:17 UTC, previous commit is e060934)' print -R 'ZIM_HOME: '${ZIM_HOME} print -R 'Zsh version: '${ZSH_VERSION} print -R 'System info: '$(command uname -a) @@ -595,7 +595,7 @@ case \${ACTION} in update) if [[ ! -r \${INFO_TARGET} ]]; then if (( PRINTLEVEL > 0 )); then - print -u2 -PR $'\E[2K\r'\"%F{yellow}! %B\${MODULE}:%b Module was not installed using Zim's degit. Will not try to update. You can disable this with the zmodule option -z|--frozen.%f\" + print -u2 -PR $'\E[2K\r'\"%F{yellow}! %B\${MODULE}:%b Module was not installed using Zim's degit. Will not try to update. Use zmodule option %B-z%b|%B--frozen%b to disable this warning.%f\" fi return 0 fi @@ -649,7 +649,7 @@ case \${ACTION} in update) if [[ ! -r \${DIR}/.git ]]; then if (( PRINTLEVEL > 0 )); then - print -u2 -PR $'\E[2K\r'\"%F{yellow}! %B\${MODULE}:%b Module was not installed using git. Will not try to update. You can disable this with the zmodule option -z|--frozen.%f\" + print -u2 -PR $'\E[2K\r'\"%F{yellow}! %B\${MODULE}:%b Module was not installed using git. Will not try to update. Use zmodule option %B-z%b|%B--frozen%b to disable this warning.%f\" fi return 0 fi @@ -672,7 +672,12 @@ case \${ACTION} in print_error 'Error during git remote set-head' \${ERR} return 1 fi - REV=\${\$(command git -C \${DIR} symbolic-ref --short refs/remotes/origin/HEAD)#origin/} || return 1 + if REV=\$(command git -C \${DIR} symbolic-ref --short refs/remotes/origin/HEAD 2>&1); then + REV=\${REV#origin/} + else + print_error 'Error during git symbolic-ref' \${REV} + return 1 + fi fi if [[ \${TYPE} == branch ]]; then LOG_REV=\${REV}@{u} @@ -728,10 +733,9 @@ Actions: Use %B-v%b to also see the modules details. %Binstall%b Install new modules. Also does %Bbuild%b and %Bcompile%b. Use %B-v%b to also see their output, and see skipped modules. - %Buninstall%b Delete unused modules. Prompts for confirmation. Use option %B-q%b to uninstall - quietly. - %Bupdate%b Update current modules. Also does %Bbuild%b and %Bcompile%b. Use %B-v%b to see their - output, and see skipped modules. + %Buninstall%b Delete unused modules. Prompts for confirmation. Use %B-q%b for quiet uninstall. + %Bupdate%b Update current modules. Also does %Bbuild%b and %Bcompile%b. Use %B-v%b to also see + their output, and see skipped modules. %Bupgrade%b Upgrade zimfw. Also does %Bcompile%b. Use %B-v%b to also see its output. %Bversion%b Print zimfw version.