1
0
Fork 0
mirror of synced 2024-11-22 15:25:34 -05:00

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.
This commit is contained in:
Eric Nielsen 2022-08-02 12:49:09 -05:00
parent b5703f9e17
commit 887bfd6a03
No known key found for this signature in database
GPG key ID: 678AF5E338C87D99
6 changed files with 30 additions and 23 deletions

View file

@ -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 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}`. download the `zimfw.zsh` script once and keep it at `${ZIM_HOME}`.
4. To automatically install missing modules and update the initialization script 4. To automatically install missing modules and update the static initialization
if missing or outdated: script if missing or outdated:
```zsh ```zsh
# Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated. # Install missing modules, and update ${ZIM_HOME}/init.zsh if missing or outdated.
if [[ ! ${ZIM_HOME}/init.zsh -nt ${ZDOTDIR:-${HOME}}/.zimrc ]]; then 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 it, you must remember to manually run `zimfw install` every time after you
update your [`~/.zimrc`](#create-zimrc) file. 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 ```zsh
# Initialize modules. # Initialize modules.
source ${ZIM_HOME}/init.zsh source ${ZIM_HOME}/init.zsh
@ -166,8 +166,9 @@ define the modules you want to use.
Usage Usage
----- -----
The `zimfw` plugin manager builds an initialization script, at `${ZIM_HOME}/init.zsh`, The `zimfw` plugin manager installs your modules at `${ZIM_HOME}/modules`, and
that initializes the modules you defined in your `~/.zimrc` file. 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 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. use. The modules will be initialized in the order they are defined.

View file

@ -5,7 +5,7 @@ _zimfw_version_check() {
if [[ -w ${ztarget:h} && ! -f ${ztarget}(#qNm-30) ]]; then if [[ -w ${ztarget:h} && ! -f ${ztarget}(#qNm-30) ]]; then
# Get latest version (get all `v*` tags from repo, delete `*v` from beginning, # 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) # 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} &! https://github.com/zimfw/zimfw.git 'v*' 2>/dev/null)"}##*v}[1]} >! ${ztarget} &!
fi fi
if [[ -f ${ztarget} ]]; then if [[ -f ${ztarget} ]]; then

View file

@ -1,6 +1,9 @@
_zimfw_info() { _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 '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 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION} print -R 'ZSH_VERSION: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a)
} }

View file

@ -1,17 +1,17 @@
_zimfw_run_tool() { _zimfw_run_tool() {
local -r zname=${1} local -r zname=${1}
if [[ -z ${_zurls[${zname}]} ]]; then 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 return 0
fi fi
if (( _zfrozens[${zname}] )); then 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 return 0
fi fi
case ${_zargs_action} in case ${_zargs_action} in
install) install)
if [[ -e ${_zdirs[${zname}]} ]]; then 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 return 0
fi fi
_zimfw_print -nR <%= clear_line %>"Installing ${zname}<%= ellipsis %>" _zimfw_print -nR <%= clear_line %>"Installing ${zname}<%= ellipsis %>"

View file

@ -4,7 +4,7 @@ class Zim
:clear_line, :ellipsis, :okay, :warn, :error, :done, :failed :clear_line, :ellipsis, :okay, :warn, :error, :done, :failed
def initialize def initialize
@version = "1.9.1" @version = "1.10.0-SNAPSHOT"
@home = "${ZDOTDIR:-${HOME}}" @home = "${ZDOTDIR:-${HOME}}"
@min_zsh_version = "5.2" @min_zsh_version = "5.2"
# Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo # Matches {ssh,http,https,git}://{user@,}host/org/repo and {user@,}host:org/repo

View file

@ -317,7 +317,7 @@ _zimfw_version_check() {
if [[ -w ${ztarget:h} && ! -f ${ztarget}(#qNm-30) ]]; then if [[ -w ${ztarget:h} && ! -f ${ztarget}(#qNm-30) ]]; then
# Get latest version (get all `v*` tags from repo, delete `*v` from beginning, # 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) # 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} &! https://github.com/zimfw/zimfw.git 'v*' 2>/dev/null)"}##*v}[1]} >! ${ztarget} &!
fi fi
if [[ -f ${ztarget} ]]; then if [[ -f ${ztarget} ]]; then
@ -384,10 +384,13 @@ _zimfw_compile() {
} }
_zimfw_info() { _zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2022-05-24 21:25:10 UTC, previous commit is 5bcfb8c)' 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 'ZIM_HOME: '${ZIM_HOME}
print -R 'Zsh version: '${ZSH_VERSION} print -R 'ZSH_VERSION: '${ZSH_VERSION}
print -R 'System info: '$(command uname -a)
} }
_zimfw_install_update() { _zimfw_install_update() {
@ -467,17 +470,17 @@ _zimfw_run_list() {
_zimfw_run_tool() { _zimfw_run_tool() {
local -r zname=${1} local -r zname=${1}
if [[ -z ${_zurls[${zname}]} ]]; then 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 return 0
fi fi
if (( _zfrozens[${zname}] )); then 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 return 0
fi fi
case ${_zargs_action} in case ${_zargs_action} in
install) install)
if [[ -e ${_zdirs[${zname}]} ]]; then 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 return 0
fi fi
_zimfw_print -nR $'\E[2K\r'"Installing ${zname} ..." _zimfw_print -nR $'\E[2K\r'"Installing ${zname} ..."
@ -756,7 +759,7 @@ esac
zimfw() { zimfw() {
builtin emulate -L zsh -o EXTENDED_GLOB builtin emulate -L zsh -o EXTENDED_GLOB
local -r _zversion='1.9.1' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b] local -r _zversion='1.10.0-SNAPSHOT' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
Actions: Actions:
%Bbuild%b Build %B${ZIM_HOME}/init.zsh%b and %B${ZIM_HOME}/login_init.zsh%b. %Bbuild%b Build %B${ZIM_HOME}/init.zsh%b and %B${ZIM_HOME}/login_init.zsh%b.