From dab4b87a29ec3947869e1931498f1582938c3751 Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Mon, 13 Jan 2020 12:24:43 -0500 Subject: [PATCH] Add help and version actions --- CHANGELOG.md | 3 ++- README.md | 8 ++++---- src/stage2/80_zimfw.zsh.erb | 4 ++++ zimfw.zsh | 6 +++++- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9a1095..6437b6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Added +- `help` and `version` actions. - `-v` verbose option. Normal mode output is now cleaner and more focused. ### Changed @@ -21,7 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Zsh 5.2 does not recognize the `:P` modifier. Replace it by `:A`. - Also compile and clean .zprofile among the startup files. -- Don't fail on `zimfw clean-dumpfile` when there's nothing to remove. +- Don't fail on `clean-dumpfile` when there's nothing to remove. ## [1.0.0] - 2020-01-07 diff --git a/README.md b/README.md index 78f51f4..7980f2a 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -Zsh IMproved FrameWork -====================== -
+Zsh IMproved FrameWork +====================== + What is Zim? ------------ Zim is a Zsh configuration framework with [blazing speed] and modular extensions. @@ -129,7 +129,7 @@ Want to upgrade `~/.zim/zimfw.zsh` to the latest version? Run: zimfw upgrade -For more information about the `zimfw` tool, run `zimfw` with no parameters. +For more information about the `zimfw` tool, run `zimfw help`. Uninstalling ------------ diff --git a/src/stage2/80_zimfw.zsh.erb b/src/stage2/80_zimfw.zsh.erb index a5bfc89..fc675bf 100644 --- a/src/stage2/80_zimfw.zsh.erb +++ b/src/stage2/80_zimfw.zsh.erb @@ -8,11 +8,13 @@ Actions: %Bclean-compiled%b Clean Zsh compiled files %Bclean-dumpfile%b Clean completion dump file %Bcompile%b Compile Zsh files + %Bhelp%b Print this help %Binfo%b Print Zim and system info %Binstall%b Install new modules %Buninstall%b Delete unused modules %Bupdate%b Update current modules %Bupgrade%b Upgrade zimfw.zsh + %Bversion%b Print Zim version Options: %B-q%b Quiet, only outputs errors @@ -55,6 +57,7 @@ Options: clean-compiled) _zimfw_clean_compiled ;; clean-dumpfile) _zimfw_clean_dumpfile ;; compile) _zimfw_build_login_init && _zimfw_compile ;; + help) print -P ${zusage} ;; info) _zimfw_info ;; install|update) _zimfw_source_zimrc 1 || return 1 @@ -69,6 +72,7 @@ Options: (( _zprintlevel-- )) _zimfw_build_login_init && _zimfw_compile ;; + version) print '<%= version %>' ;; *) print -u2 -PR "%F{red}${0}: Unknown action ${1}%f"$'\n'${zusage} return 1 diff --git a/zimfw.zsh b/zimfw.zsh index 1b4cfd8..e4fa34e 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -260,7 +260,7 @@ _zimfw_compile() { } _zimfw_info() { - print 'Zim version: 1.1.0-SNAPSHOT (previous commit is f6f7815)' + print 'Zim version: 1.1.0-SNAPSHOT (previous commit is 6806bea)' print -R 'ZIM_HOME: '${ZIM_HOME} print -R 'Zsh version: '${ZSH_VERSION} print -R 'System info: '$(command uname -a) @@ -310,11 +310,13 @@ Actions: %Bclean-compiled%b Clean Zsh compiled files %Bclean-dumpfile%b Clean completion dump file %Bcompile%b Compile Zsh files + %Bhelp%b Print this help %Binfo%b Print Zim and system info %Binstall%b Install new modules %Buninstall%b Delete unused modules %Bupdate%b Update current modules %Bupgrade%b Upgrade zimfw.zsh + %Bversion%b Print Zim version Options: %B-q%b Quiet, only outputs errors @@ -437,6 +439,7 @@ fi clean-compiled) _zimfw_clean_compiled ;; clean-dumpfile) _zimfw_clean_dumpfile ;; compile) _zimfw_build_login_init && _zimfw_compile ;; + help) print -P ${zusage} ;; info) _zimfw_info ;; install|update) _zimfw_source_zimrc 1 || return 1 @@ -451,6 +454,7 @@ fi (( _zprintlevel-- )) _zimfw_build_login_init && _zimfw_compile ;; + version) print '1.1.0-SNAPSHOT' ;; *) print -u2 -PR "%F{red}${0}: Unknown action ${1}%f"$'\n'${zusage} return 1