1
0
Fork 0
mirror of synced 2024-12-25 07:23:21 -05:00

Improve zimfw's degit error message

Hopefully make it clearer when either the git or the degit tool is being
used.

See #535
This commit is contained in:
Eric Nielsen 2024-05-30 09:34:43 -05:00
parent cdd9258d5c
commit 96f60da366
No known key found for this signature in database
GPG key ID: 678AF5E338C87D99
3 changed files with 7 additions and 7 deletions

View file

@ -4,7 +4,7 @@ _zimfw_download_tarball() {
readonly REPO=${match[4]%.git} readonly REPO=${match[4]%.git}
fi fi
if [[ ${HOST} != github.com || -z ${REPO} ]]; then if [[ ${HOST} != github.com || -z ${REPO} ]]; then
_zimfw_print_error "${URL} is not a valid GitHub URL. Will not try to ${_zaction}." _zimfw_print_error ${URL}$' is not a valid URL. Will not try to '${_zaction}$'. The zimfw degit tool only supports GitHub URLs. Use zmodule option <%= bold %>--use git<%= normalred %> to use git instead.'
return 1 return 1
fi fi
readonly HEADERS_TARGET=${DIR}/${TEMP}_headers readonly HEADERS_TARGET=${DIR}/${TEMP}_headers
@ -12,7 +12,7 @@ _zimfw_download_tarball() {
if [[ -r ${INFO_TARGET} ]]; then if [[ -r ${INFO_TARGET} ]]; then
readonly INFO=("${(@f)"$(<${INFO_TARGET})"}") readonly INFO=("${(@f)"$(<${INFO_TARGET})"}")
if [[ ${URL} != ${INFO[1]} ]]; then if [[ ${URL} != ${INFO[1]} ]]; then
_zimfw_print_error "URL does not match. Expected ${URL}. Will not try to ${_zaction}." _zimfw_print_error "The zimfw degit URL does not match. Expected ${URL}. Will not try to ${_zaction}."
return 1 return 1
fi fi
# Previous REV is in line 2, reserved for future use. # Previous REV is in line 2, reserved for future use.

View file

@ -18,7 +18,7 @@ _zimfw_tool_git() {
return 0 return 0
fi fi
if [[ ${URL} != $(command git -C ${DIR} config --get remote.origin.url) ]]; then if [[ ${URL} != $(command git -C ${DIR} config --get remote.origin.url) ]]; then
_zimfw_print_error "URL does not match. Expected ${URL}. Will not try to ${_zaction}." _zimfw_print_error "The git URL does not match. Expected ${URL}. Will not try to ${_zaction}."
return 1 return 1
fi fi
if ! ERR=$(command git -C ${DIR} fetch -pqt origin 2>&1); then if ! ERR=$(command git -C ${DIR} fetch -pqt origin 2>&1); then

View file

@ -457,7 +457,7 @@ _zimfw_compile() {
} }
_zimfw_info() { _zimfw_info() {
print -R 'zimfw version: '${_zversion}' (built at 2024-05-30 14:18:19 UTC, previous commit is 6c4e1b0)' print -R 'zimfw version: '${_zversion}' (built at 2024-05-30 14:34:14 UTC, previous commit is cdd9258)'
local zparam local zparam
for zparam in LANG ${(Mk)parameters:#LC_*} OSTYPE TERM TERM_PROGRAM TERM_PROGRAM_VERSION ZIM_HOME ZSH_VERSION; do for zparam in LANG ${(Mk)parameters:#LC_*} OSTYPE TERM TERM_PROGRAM TERM_PROGRAM_VERSION ZIM_HOME ZSH_VERSION; do
print -R ${(r.22....:.)zparam}${(P)zparam} print -R ${(r.22....:.)zparam}${(P)zparam}
@ -581,7 +581,7 @@ _zimfw_download_tarball() {
readonly REPO=${match[4]%.git} readonly REPO=${match[4]%.git}
fi fi
if [[ ${HOST} != github.com || -z ${REPO} ]]; then if [[ ${HOST} != github.com || -z ${REPO} ]]; then
_zimfw_print_error "${URL} is not a valid GitHub URL. Will not try to ${_zaction}." _zimfw_print_error ${URL}$' is not a valid URL. Will not try to '${_zaction}$'. The zimfw degit tool only supports GitHub URLs. Use zmodule option \E[1m--use git\E[0;31m to use git instead.'
return 1 return 1
fi fi
readonly HEADERS_TARGET=${DIR}/${TEMP}_headers readonly HEADERS_TARGET=${DIR}/${TEMP}_headers
@ -589,7 +589,7 @@ _zimfw_download_tarball() {
if [[ -r ${INFO_TARGET} ]]; then if [[ -r ${INFO_TARGET} ]]; then
readonly INFO=("${(@f)"$(<${INFO_TARGET})"}") readonly INFO=("${(@f)"$(<${INFO_TARGET})"}")
if [[ ${URL} != ${INFO[1]} ]]; then if [[ ${URL} != ${INFO[1]} ]]; then
_zimfw_print_error "URL does not match. Expected ${URL}. Will not try to ${_zaction}." _zimfw_print_error "The zimfw degit URL does not match. Expected ${URL}. Will not try to ${_zaction}."
return 1 return 1
fi fi
# Previous REV is in line 2, reserved for future use. # Previous REV is in line 2, reserved for future use.
@ -741,7 +741,7 @@ _zimfw_tool_git() {
return 0 return 0
fi fi
if [[ ${URL} != $(command git -C ${DIR} config --get remote.origin.url) ]]; then if [[ ${URL} != $(command git -C ${DIR} config --get remote.origin.url) ]]; then
_zimfw_print_error "URL does not match. Expected ${URL}. Will not try to ${_zaction}." _zimfw_print_error "The git URL does not match. Expected ${URL}. Will not try to ${_zaction}."
return 1 return 1
fi fi
if ! ERR=$(command git -C ${DIR} fetch -pqt origin 2>&1); then if ! ERR=$(command git -C ${DIR} fetch -pqt origin 2>&1); then