1
0
Fork 0
mirror of synced 2024-11-22 23:35:35 -05:00

Update zimfw help text to be more detailed

and add more comments to the code to also hopefully make it clearer.
This commit is contained in:
Eric Nielsen 2021-09-21 08:27:56 -05:00
parent 7deda9c7f4
commit 9a67adfe3b
No known key found for this signature in database
GPG key ID: 47D1DBFA0765A1FB
6 changed files with 48 additions and 44 deletions

View file

@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added ### Added
- `list` action. Using it with `-v` shows all current details for the existing - `list` action. Using it with `-v` also shows the current details for all
modules. modules.
### Fixed ### Fixed

View file

@ -7,6 +7,7 @@ _zimfw_build_init() {
_zimfw_mv =( _zimfw_mv =(
print -R "zimfw() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }" print -R "zimfw() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zmodule() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }" print -R "zmodule() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
# Remove all prefixes from _zfpaths, _zfunctions and _zcmds
local -r zpre=$'*\0' local -r zpre=$'*\0'
if (( ${#_zfpaths} )) print -R 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})' if (( ${#_zfpaths} )) print -R 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})'
if (( ${#_zfunctions} )) print -R 'autoload -Uz '${_zfunctions#${~zpre}} if (( ${#_zfunctions} )) print -R 'autoload -Uz '${_zfunctions#${~zpre}}

View file

@ -172,10 +172,11 @@ Initialization options:
fi fi
_zmodules+=(${zmodule}) _zmodules+=(${zmodule})
_zdirs+=(${zdir}) _zdirs+=(${zdir})
# ${zmodule}$'\0' prefix is added to all zfpaths, zfunctions and zcmds to distinguish the originating modules # Prefix is added to all _zfpaths, _zfunctions and _zcmds to distinguish the originating modules
_zfpaths+=(${zmodule}$'\0'${^zfpaths}) local -r zpre=${zmodule}$'\0'
_zfunctions+=(${zmodule}$'\0'${^zfunctions}) _zfpaths+=(${zpre}${^zfpaths})
_zcmds+=(${zmodule}$'\0'${^zcmds}) _zfunctions+=(${zpre}${^zfunctions})
_zcmds+=(${zpre}${^zcmds})
fi fi
fi fi
} }

View file

@ -16,6 +16,7 @@ _zimfw_run_list() {
fi fi
print -R ", using ${ztool}" print -R ", using ${ztool}"
fi fi
# Match and remove the current module prefix from _zfpaths, _zfunctions and _zcmds
local -r zpre=${zmodule}$'\0' local -r zpre=${zmodule}$'\0'
local -r zfpaths=(${${(M)_zfpaths:#${zpre}*}#${zpre}}) zfunctions=(${${(M)_zfunctions:#${zpre}*}#${zpre}}) zcmds=(${${(M)_zcmds:#${zpre}*}#${zpre}}) local -r zfpaths=(${${(M)_zfpaths:#${zpre}*}#${zpre}}) zfunctions=(${${(M)_zfunctions:#${zpre}*}#${zpre}}) zcmds=(${${(M)_zcmds:#${zpre}*}#${zpre}})
if (( ${#zfpaths} )) print -R " fpath: ${zfpaths[@]}" if (( ${#zfpaths} )) print -R " fpath: ${zfpaths[@]}"

View file

@ -2,25 +2,24 @@ zimfw() {
local -r _zversion='<%= version %>' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b] local -r _zversion='<%= version %>' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
Actions: Actions:
%Bbuild%b Build %Binit.zsh%b and %Blogin_init.zsh%b %Bbuild%b Build %B${ZIM_HOME}/init.zsh%b and %B${ZIM_HOME}/login_init.zsh%b.
%Bclean%b Clean all (see below) Also does %Bcompile%b. Use %B-v%b to also see its output.
%Bclean-compiled%b Clean Zsh compiled files %Bclean%b Clean all. Does both %Bclean-compiled%b and %Bclean-dumpfile%b.
%Bclean-dumpfile%b Clean completion dump file %Bclean-compiled%b Clean Zsh compiled files.
%Bcompile%b Compile Zsh files %Bclean-dumpfile%b Clean completion dump file.
%Bhelp%b Print this help %Bcompile%b Compile Zsh files.
%Binfo%b Print Zim and system info %Bhelp%b Print this help.
%Blist%b List all modules %Binfo%b Print Zim and system info.
%Binstall%b Install new modules %Blist%b List all modules. Use %B-v%b to also see the current details for all modules.
%Buninstall%b Delete unused modules %Binstall%b Install new modules. Also does %Bbuild%b, %Bcompile%b. Use %B-v%b to also see their output.
(prompts for confirmation) %Buninstall%b Delete unused modules. Prompts for confirmation. Use %B-q%b to uninstall quietly.
%Bupdate%b Update current modules %Bupdate%b Update current modules. Also does %Bbuild%b, %Bcompile%b. Use %B-v%b to see their output.
%Bupgrade%b Upgrade zimfw %Bupgrade%b Upgrade zimfw. Also does %Bcompile%b. Use %B-v%b to also see its output.
%Bversion%b Print zimfw version %Bversion%b Print zimfw version.
Options: Options:
%B-q%b Quiet (yes to prompts, and %B-q%b Quiet (yes to prompts, and only outputs errors and warnings)
only outputs errors and warnings) %B-v%b Verbose (outputs more details)"
%B-v%b Verbose"
local -a _zdisableds _zmodules _zdirs _zfpaths _zfunctions _zcmds _zmodules_zargs _zunuseds local -a _zdisableds _zmodules _zdirs _zfpaths _zfunctions _zcmds _zmodules_zargs _zunuseds
local -i _zprintlevel=1 local -i _zprintlevel=1
if (( # > 2 )); then if (( # > 2 )); then

View file

@ -60,6 +60,7 @@ _zimfw_build_init() {
_zimfw_mv =( _zimfw_mv =(
print -R "zimfw() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }" print -R "zimfw() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
print -R "zmodule() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }" print -R "zmodule() { source ${ZIM_HOME}/zimfw.zsh \"\${@}\" }"
# Remove all prefixes from _zfpaths, _zfunctions and _zcmds
local -r zpre=$'*\0' local -r zpre=$'*\0'
if (( ${#_zfpaths} )) print -R 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})' if (( ${#_zfpaths} )) print -R 'fpath=('${${_zfpaths#${~zpre}}:A}' ${fpath})'
if (( ${#_zfunctions} )) print -R 'autoload -Uz '${_zfunctions#${~zpre}} if (( ${#_zfunctions} )) print -R 'autoload -Uz '${_zfunctions#${~zpre}}
@ -281,10 +282,11 @@ Initialization options:
fi fi
_zmodules+=(${zmodule}) _zmodules+=(${zmodule})
_zdirs+=(${zdir}) _zdirs+=(${zdir})
# ${zmodule}$'\0' prefix is added to all zfpaths, zfunctions and zcmds to distinguish the originating modules # Prefix is added to all _zfpaths, _zfunctions and _zcmds to distinguish the originating modules
_zfpaths+=(${zmodule}$'\0'${^zfpaths}) local -r zpre=${zmodule}$'\0'
_zfunctions+=(${zmodule}$'\0'${^zfunctions}) _zfpaths+=(${zpre}${^zfpaths})
_zcmds+=(${zmodule}$'\0'${^zcmds}) _zfunctions+=(${zpre}${^zfunctions})
_zcmds+=(${zpre}${^zcmds})
fi fi
fi fi
} }
@ -368,7 +370,7 @@ _zimfw_compile() {
} }
_zimfw_info() { _zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2021-09-21 01:00:09 UTC, previous commit is b3b282f)' print -R 'zimfw version: '${_zversion}' (built at 2021-09-21 13:25:55 UTC, previous commit is 7deda9c)'
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) print -R 'System info: '$(command uname -a)
@ -429,6 +431,7 @@ _zimfw_run_list() {
fi fi
print -R ", using ${ztool}" print -R ", using ${ztool}"
fi fi
# Match and remove the current module prefix from _zfpaths, _zfunctions and _zcmds
local -r zpre=${zmodule}$'\0' local -r zpre=${zmodule}$'\0'
local -r zfpaths=(${${(M)_zfpaths:#${zpre}*}#${zpre}}) zfunctions=(${${(M)_zfunctions:#${zpre}*}#${zpre}}) zcmds=(${${(M)_zcmds:#${zpre}*}#${zpre}}) local -r zfpaths=(${${(M)_zfpaths:#${zpre}*}#${zpre}}) zfunctions=(${${(M)_zfunctions:#${zpre}*}#${zpre}}) zcmds=(${${(M)_zcmds:#${zpre}*}#${zpre}})
if (( ${#zfpaths} )) print -R " fpath: ${zfpaths[@]}" if (( ${#zfpaths} )) print -R " fpath: ${zfpaths[@]}"
@ -705,25 +708,24 @@ zimfw() {
local -r _zversion='1.6.0-SNAPSHOT' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b] local -r _zversion='1.6.0-SNAPSHOT' zusage="Usage: %B${0}%b <action> [%B-q%b|%B-v%b]
Actions: Actions:
%Bbuild%b Build %Binit.zsh%b and %Blogin_init.zsh%b %Bbuild%b Build %B${ZIM_HOME}/init.zsh%b and %B${ZIM_HOME}/login_init.zsh%b.
%Bclean%b Clean all (see below) Also does %Bcompile%b. Use %B-v%b to also see its output.
%Bclean-compiled%b Clean Zsh compiled files %Bclean%b Clean all. Does both %Bclean-compiled%b and %Bclean-dumpfile%b.
%Bclean-dumpfile%b Clean completion dump file %Bclean-compiled%b Clean Zsh compiled files.
%Bcompile%b Compile Zsh files %Bclean-dumpfile%b Clean completion dump file.
%Bhelp%b Print this help %Bcompile%b Compile Zsh files.
%Binfo%b Print Zim and system info %Bhelp%b Print this help.
%Blist%b List all modules %Binfo%b Print Zim and system info.
%Binstall%b Install new modules %Blist%b List all modules. Use %B-v%b to also see the current details for all modules.
%Buninstall%b Delete unused modules %Binstall%b Install new modules. Also does %Bbuild%b, %Bcompile%b. Use %B-v%b to also see their output.
(prompts for confirmation) %Buninstall%b Delete unused modules. Prompts for confirmation. Use %B-q%b to uninstall quietly.
%Bupdate%b Update current modules %Bupdate%b Update current modules. Also does %Bbuild%b, %Bcompile%b. Use %B-v%b to see their output.
%Bupgrade%b Upgrade zimfw %Bupgrade%b Upgrade zimfw. Also does %Bcompile%b. Use %B-v%b to also see its output.
%Bversion%b Print zimfw version %Bversion%b Print zimfw version.
Options: Options:
%B-q%b Quiet (yes to prompts, and %B-q%b Quiet (yes to prompts, and only outputs errors and warnings)
only outputs errors and warnings) %B-v%b Verbose (outputs more details)"
%B-v%b Verbose"
local -a _zdisableds _zmodules _zdirs _zfpaths _zfunctions _zcmds _zmodules_zargs _zunuseds local -a _zdisableds _zmodules _zdirs _zfpaths _zfunctions _zcmds _zmodules_zargs _zunuseds
local -i _zprintlevel=1 local -i _zprintlevel=1
if (( # > 2 )); then if (( # > 2 )); then