From 887bfd6a03633ad40589abbaf809f33ef4e99ef3 Mon Sep 17 00:00:00 2001 From: Eric Nielsen <4120606+ericbn@users.noreply.github.com> Date: Tue, 2 Aug 2022 12:49:09 -0500 Subject: [PATCH] Update info action output and update README.md Show the value of some relevant environment variables instead of calling uname, which might show private information like the host name. Other minor fixes regarding output. --- README.md | 11 ++++++----- src/stage2/40_zimfw_version_check.zsh.erb | 2 +- src/stage2/50_zimfw_info.zsh.erb | 11 +++++++---- src/stage2/70_zimfw_run_tool.zsh.erb | 6 +++--- src/zimfw.zsh.erb | 2 +- zimfw.zsh | 21 ++++++++++++--------- 6 files changed, 30 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 9638ede..e3de367 100644 --- a/README.md +++ b/README.md @@ -110,8 +110,8 @@ Add the lines below to your `~/.zshrc` file, in the following order: This is optional. If you choose to not include this step, you should manually download the `zimfw.zsh` script once and keep it at `${ZIM_HOME}`. -4. To automatically install missing modules and update the initialization script - if missing or outdated: +4. To automatically install missing modules and update the static initialization + script if missing or outdated: ```zsh # Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated. if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then @@ -122,7 +122,7 @@ Add the lines below to your `~/.zshrc` file, in the following order: it, you must remember to manually run `zimfw install` every time after you update your [`~/.zimrc`](#create-zimrc) file. -5. To source the initialization script, that initializes your modules: +5. To source the static script, that will initialize your modules: ```zsh # Initialize modules. source ${ZIM_HOME}/init.zsh @@ -166,8 +166,9 @@ define the modules you want to use. Usage ----- -The `zimfw` plugin manager builds an initialization script, at `${ZIM_HOME}/init.zsh`, -that initializes the modules you defined in your `~/.zimrc` file. +The `zimfw` plugin manager installs your modules at `${ZIM_HOME}/modules`, and +builds a static script at `${ZIM_HOME}/init.zsh` that will initialize them. Your +modules are defined in your `~/.zimrc` file. The `~/.zimrc` file must contain a `zmodule` call for each module you want to use. The modules will be initialized in the order they are defined. diff --git a/src/stage2/40_zimfw_version_check.zsh.erb b/src/stage2/40_zimfw_version_check.zsh.erb index 8b21b37..97c3136 100644 --- a/src/stage2/40_zimfw_version_check.zsh.erb +++ b/src/stage2/40_zimfw_version_check.zsh.erb @@ -5,7 +5,7 @@ _zimfw_version_check() { if [[ -w ${ztarget:h} && ! -f ${ztarget}(#qNm-30) ]]; then # Get latest version (get all `v*` tags from repo, delete `*v` from beginning, # sort in descending `O`rder `n`umerically, and get the `[1]` first) - print ${${(On)${(f)"$(command git ls-remote --tags --refs \ + print -R ${${(On)${(f)"$(command git ls-remote --tags --refs \ https://github.com/zimfw/zimfw.git 'v*' 2>/dev/null)"}##*v}[1]} >! ${ztarget} &! fi if [[ -f ${ztarget} ]]; then diff --git a/src/stage2/50_zimfw_info.zsh.erb b/src/stage2/50_zimfw_info.zsh.erb index 07d710d..ef0f289 100644 --- a/src/stage2/50_zimfw_info.zsh.erb +++ b/src/stage2/50_zimfw_info.zsh.erb @@ -1,6 +1,9 @@ _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at <%= Time.now.utc %>, previous commit is <%= `git rev-parse --short HEAD | tr -d '\r\n'` %>)' - print -R 'ZIM_HOME: '${ZIM_HOME} - print -R 'Zsh version: '${ZSH_VERSION} - print -R 'System info: '$(command uname -a) + print -R 'zimfw version: '${_zversion}' (built at <%= Time.now.utc %>, previous commit is <%= `git rev-parse --short HEAD | tr -d '\r\n'` %>)' + print -R 'OSTYPE: '${OSTYPE} + print -R 'TERM: '${TERM} + print -R 'TERM_PROGRAM: '${TERM_PROGRAM} + print -R 'TERM_PROGRAM_VERSION: '${TERM_PROGRAM_VERSION} + print -R 'ZIM_HOME: '${ZIM_HOME} + print -R 'ZSH_VERSION: '${ZSH_VERSION} } diff --git a/src/stage2/70_zimfw_run_tool.zsh.erb b/src/stage2/70_zimfw_run_tool.zsh.erb index 319efaf..6a5d84f 100644 --- a/src/stage2/70_zimfw_run_tool.zsh.erb +++ b/src/stage2/70_zimfw_run_tool.zsh.erb @@ -1,17 +1,17 @@ _zimfw_run_tool() { local -r zname=${1} if [[ -z ${_zurls[${zname}]} ]]; then - if (( _zprintlevel > 1 )) print -u2 -PR <%= clear_line %>"<%= okay %>%B${zname}:%b Skipping external module" + if (( _zprintlevel > 1 )) print -PR <%= clear_line %>"<%= okay %>%B${zname}:%b Skipping external module" return 0 fi if (( _zfrozens[${zname}] )); then - if (( _zprintlevel > 1 )) print -u2 -PR <%= clear_line %>"<%= okay %>%B${zname}:%b Skipping frozen module" + if (( _zprintlevel > 1 )) print -PR <%= clear_line %>"<%= okay %>%B${zname}:%b Skipping frozen module" return 0 fi case ${_zargs_action} in install) if [[ -e ${_zdirs[${zname}]} ]]; then - if (( _zprintlevel > 1 )) print -u2 -PR <%= clear_line %>"<%= okay %>%B${zname}:%b Skipping already installed module" + if (( _zprintlevel > 1 )) print -PR <%= clear_line %>"<%= okay %>%B${zname}:%b Skipping already installed module" return 0 fi _zimfw_print -nR <%= clear_line %>"Installing ${zname}<%= ellipsis %>" diff --git a/src/zimfw.zsh.erb b/src/zimfw.zsh.erb index 9ae1d01..34fec01 100644 --- a/src/zimfw.zsh.erb +++ b/src/zimfw.zsh.erb @@ -4,7 +4,7 @@ class Zim :clear_line, :ellipsis, :okay, :warn, :error, :done, :failed def initialize - @version = "1.9.1" + @version = "1.10.0-SNAPSHOT" @home = "${ZDOTDIR:-${HOME}}" @min_zsh_version = "5.2" # Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo diff --git a/zimfw.zsh b/zimfw.zsh index 6743857..eefbb12 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -317,7 +317,7 @@ _zimfw_version_check() { if [[ -w ${ztarget:h} && ! -f ${ztarget}(#qNm-30) ]]; then # Get latest version (get all `v*` tags from repo, delete `*v` from beginning, # sort in descending `O`rder `n`umerically, and get the `[1]` first) - print ${${(On)${(f)"$(command git ls-remote --tags --refs \ + print -R ${${(On)${(f)"$(command git ls-remote --tags --refs \ https://github.com/zimfw/zimfw.git 'v*' 2>/dev/null)"}##*v}[1]} >! ${ztarget} &! fi if [[ -f ${ztarget} ]]; then @@ -384,10 +384,13 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (built at 2022-05-24 21:25:10 UTC, previous commit is 5bcfb8c)' - print -R 'ZIM_HOME: '${ZIM_HOME} - print -R 'Zsh version: '${ZSH_VERSION} - print -R 'System info: '$(command uname -a) + print -R 'zimfw version: '${_zversion}' (built at 2022-08-02 17:46:34 UTC, previous commit is b5703f9)' + print -R 'OSTYPE: '${OSTYPE} + print -R 'TERM: '${TERM} + print -R 'TERM_PROGRAM: '${TERM_PROGRAM} + print -R 'TERM_PROGRAM_VERSION: '${TERM_PROGRAM_VERSION} + print -R 'ZIM_HOME: '${ZIM_HOME} + print -R 'ZSH_VERSION: '${ZSH_VERSION} } _zimfw_install_update() { @@ -467,17 +470,17 @@ _zimfw_run_list() { _zimfw_run_tool() { local -r zname=${1} if [[ -z ${_zurls[${zname}]} ]]; then - if (( _zprintlevel > 1 )) print -u2 -PR $'\E[2K\r'"%F{green})%f %B${zname}:%b Skipping external module" + if (( _zprintlevel > 1 )) print -PR $'\E[2K\r'"%F{green})%f %B${zname}:%b Skipping external module" return 0 fi if (( _zfrozens[${zname}] )); then - if (( _zprintlevel > 1 )) print -u2 -PR $'\E[2K\r'"%F{green})%f %B${zname}:%b Skipping frozen module" + if (( _zprintlevel > 1 )) print -PR $'\E[2K\r'"%F{green})%f %B${zname}:%b Skipping frozen module" return 0 fi case ${_zargs_action} in install) if [[ -e ${_zdirs[${zname}]} ]]; then - if (( _zprintlevel > 1 )) print -u2 -PR $'\E[2K\r'"%F{green})%f %B${zname}:%b Skipping already installed module" + if (( _zprintlevel > 1 )) print -PR $'\E[2K\r'"%F{green})%f %B${zname}:%b Skipping already installed module" return 0 fi _zimfw_print -nR $'\E[2K\r'"Installing ${zname} ..." @@ -756,7 +759,7 @@ esac zimfw() { builtin emulate -L zsh -o EXTENDED_GLOB - local -r _zversion='1.9.1' zusage="Usage: %B${0}%b [%B-q%b|%B-v%b] + local -r _zversion='1.10.0-SNAPSHOT' zusage="Usage: %B${0}%b [%B-q%b|%B-v%b] Actions: %Bbuild%b Build %B${ZIM_HOME}/init.zsh%b and %B${ZIM_HOME}/login_init.zsh%b.