Make cksum silent

so it behaves similar to `cmp -s`, which is what we had before.
This commit is contained in:
Eric Nielsen 2020-05-25 13:40:34 -05:00
parent 853e5a767c
commit e73285c4d1
No known key found for this signature in database
GPG Key ID: 47D1DBFA0765A1FB
4 changed files with 12 additions and 8 deletions

View File

@ -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

View File

@ -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

View File

@ -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 "

View File

@ -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 <action> [%B-q%b|%B-v%b]
Actions: