From e73285c4d1cda40c329f407dad24cdf151e1c83e Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Mon, 25 May 2020 13:40:34 -0500 Subject: [PATCH] Make cksum silent so it behaves similar to `cmp -s`, which is what we had before. --- CHANGELOG.md | 4 +++- src/stage2/28_zimfw_mv.zsh.erb | 5 +++-- src/zimfw.zsh.erb | 2 +- zimfw.zsh | 9 +++++---- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index abcb236..3f0057e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -_No unreleased changes._ +### Fixed +- "No such file or directory" displayed when building a new file. This was a + regression introduced after replacing `cmp` by `cksum`. ## [1.2.0] - 2020-05-17 diff --git a/src/stage2/28_zimfw_mv.zsh.erb b/src/stage2/28_zimfw_mv.zsh.erb index 1e32730..ca2bb72 100644 --- a/src/stage2/28_zimfw_mv.zsh.erb +++ b/src/stage2/28_zimfw_mv.zsh.erb @@ -1,6 +1,7 @@ _zimfw_mv() { - local -a cklines=(${(f)"$(command cksum ${@})"}) - if [[ ${${(z)cklines[1]}[1,2]} == ${${(z)cklines[2]}[1,2]} ]]; then + local -a cklines + if cklines=(${(f)"$(command cksum ${1} ${2} 2>/dev/null)"}) && \ + [[ ${${(z)cklines[1]}[1,2]} == ${${(z)cklines[2]}[1,2]} ]]; then _zimfw_print -PR "<%= okay %>%B${2}:%b Already up to date" else if [[ -e ${2} ]]; then diff --git a/src/zimfw.zsh.erb b/src/zimfw.zsh.erb index 84af29f..2058ff5 100644 --- a/src/zimfw.zsh.erb +++ b/src/zimfw.zsh.erb @@ -6,7 +6,7 @@ class Zim @home = "${ZDOTDIR:-${HOME}}" @min_zsh_version = "5.2" @startup_files_glob = ".z(shenv|profile|shrc|login|logout)" - @version = "1.2.0" + @version = "1.2.1-SNAPSHOT" @ellipsis = " ..." @okay = "%F{green})%f " @error = "x " diff --git a/zimfw.zsh b/zimfw.zsh index d5d1ec6..edc619b 100644 --- a/zimfw.zsh +++ b/zimfw.zsh @@ -37,8 +37,9 @@ _zimfw_print() { } _zimfw_mv() { - local -a cklines=(${(f)"$(command cksum ${@})"}) - if [[ ${${(z)cklines[1]}[1,2]} == ${${(z)cklines[2]}[1,2]} ]]; then + local -a cklines + if cklines=(${(f)"$(command cksum ${1} ${2} 2>/dev/null)"}) && \ + [[ ${${(z)cklines[1]}[1,2]} == ${${(z)cklines[2]}[1,2]} ]]; then _zimfw_print -PR "%F{green})%f %B${2}:%b Already up to date" else if [[ -e ${2} ]]; then @@ -295,7 +296,7 @@ _zimfw_compile() { } _zimfw_info() { - print -R 'zimfw version: '${_zversion}' (previous commit is 8724686)' + print -R 'zimfw version: '${_zversion}' (previous commit is 853e5a7)' print -R 'ZIM_HOME: '${ZIM_HOME} print -R 'Zsh version: '${ZSH_VERSION} print -R 'System info: '$(command uname -a) @@ -339,7 +340,7 @@ _zimfw_upgrade() { } zimfw() { - local -r _zversion='1.2.0' + local -r _zversion='1.2.1-SNAPSHOT' local -r zusage="Usage: %B${0}%b [%B-q%b|%B-v%b] Actions: