Replace cats with reads (passes all tests)
Signed-off-by: Ross Smith II <ross@smithii.com>
This commit is contained in:
parent
d11e094f7b
commit
814e5f8ab3
1 changed files with 28 additions and 17 deletions
43
yadm
43
yadm
|
@ -353,7 +353,7 @@ function template_default() {
|
||||||
|
|
||||||
# the explicit "space + tab" character class used below is used because not
|
# the explicit "space + tab" character class used below is used because not
|
||||||
# all versions of awk seem to support the POSIX character classes [[:blank:]]
|
# all versions of awk seem to support the POSIX character classes [[:blank:]]
|
||||||
awk_pgm=$(cat << "EOF"
|
read -r -d '' awk_pgm << "EOF"
|
||||||
# built-in default template processor
|
# built-in default template processor
|
||||||
BEGIN {
|
BEGIN {
|
||||||
blank = "[ ]"
|
blank = "[ ]"
|
||||||
|
@ -421,7 +421,6 @@ function conditions() {
|
||||||
return pattern
|
return pattern
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
)
|
|
||||||
|
|
||||||
"${AWK_PROGRAM[0]}" \
|
"${AWK_PROGRAM[0]}" \
|
||||||
-v class="$local_class" \
|
-v class="$local_class" \
|
||||||
|
@ -557,7 +556,8 @@ function report_invalid_alts() {
|
||||||
for invalid in "${INVALID_ALT[@]}"; do
|
for invalid in "${INVALID_ALT[@]}"; do
|
||||||
path_list="$path_list * $invalid"$'\n'
|
path_list="$path_list * $invalid"$'\n'
|
||||||
done
|
done
|
||||||
cat <<EOF >&2
|
local msg
|
||||||
|
IFS='' read -r -d '' msg <<EOF
|
||||||
|
|
||||||
**WARNING**
|
**WARNING**
|
||||||
Invalid alternates have been detected.
|
Invalid alternates have been detected.
|
||||||
|
@ -579,6 +579,7 @@ function report_invalid_alts() {
|
||||||
${path_list}
|
${path_list}
|
||||||
***********
|
***********
|
||||||
EOF
|
EOF
|
||||||
|
printf '%s\n' "$msg" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_stale_links() {
|
function remove_stale_links() {
|
||||||
|
@ -790,7 +791,8 @@ function clone() {
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$("$GIT_PROGRAM" ls-files --modified)" ]; then
|
if [ -n "$("$GIT_PROGRAM" ls-files --modified)" ]; then
|
||||||
cat <<EOF
|
local msg
|
||||||
|
IFS='' read -r -d '' msg <<EOF
|
||||||
**NOTE**
|
**NOTE**
|
||||||
Local files with content that differs from the ones just
|
Local files with content that differs from the ones just
|
||||||
cloned were found in $YADM_WORK. They have been left
|
cloned were found in $YADM_WORK. They have been left
|
||||||
|
@ -800,6 +802,7 @@ function clone() {
|
||||||
If you know what you're doing, and want to overwrite the
|
If you know what you're doing, and want to overwrite the
|
||||||
tracked files, consider 'yadm checkout "$YADM_WORK"'.
|
tracked files, consider 'yadm checkout "$YADM_WORK"'.
|
||||||
EOF
|
EOF
|
||||||
|
printf '%s\n' "$msg"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -n "$DEBUG" ] && display_private_perms "post-checkout"
|
[ -n "$DEBUG" ] && display_private_perms "post-checkout"
|
||||||
|
@ -826,11 +829,13 @@ function config() {
|
||||||
echo " ${supported_config}"
|
echo " ${supported_config}"
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
cat << EOF
|
local msg
|
||||||
|
read -r -d '' msg << EOF
|
||||||
Please read the CONFIGURATION section in the man
|
Please read the CONFIGURATION section in the man
|
||||||
page for more details about configurations, and
|
page for more details about configurations, and
|
||||||
how to adjust them.
|
how to adjust them.
|
||||||
EOF
|
EOF
|
||||||
|
printf '%s\n' "$msg"
|
||||||
elif [ "$use_repo_config" -eq 1 ]; then
|
elif [ "$use_repo_config" -eq 1 ]; then
|
||||||
|
|
||||||
require_repo
|
require_repo
|
||||||
|
@ -1081,7 +1086,8 @@ function git_command() {
|
||||||
|
|
||||||
function help() {
|
function help() {
|
||||||
|
|
||||||
cat << EOF
|
local msg
|
||||||
|
IFS='' read -r -d '' msg << EOF
|
||||||
Usage: yadm <command> [options...]
|
Usage: yadm <command> [options...]
|
||||||
|
|
||||||
Manage dotfiles maintained in a Git repository. Manage alternate files
|
Manage dotfiles maintained in a Git repository. Manage alternate files
|
||||||
|
@ -1114,7 +1120,7 @@ Files:
|
||||||
|
|
||||||
Use "man yadm" for complete documentation.
|
Use "man yadm" for complete documentation.
|
||||||
EOF
|
EOF
|
||||||
|
printf '%s\n' "$msg"
|
||||||
exit_with_hook 1
|
exit_with_hook 1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1151,7 +1157,8 @@ function introspect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function introspect_commands() {
|
function introspect_commands() {
|
||||||
cat <<-EOF
|
local msg
|
||||||
|
read -r -d '' msg <<-EOF
|
||||||
alt
|
alt
|
||||||
bootstrap
|
bootstrap
|
||||||
clean
|
clean
|
||||||
|
@ -1171,10 +1178,12 @@ transcrypt
|
||||||
upgrade
|
upgrade
|
||||||
version
|
version
|
||||||
EOF
|
EOF
|
||||||
|
printf '%s' "$msg"
|
||||||
}
|
}
|
||||||
|
|
||||||
function introspect_configs() {
|
function introspect_configs() {
|
||||||
cat <<-EOF
|
local msg
|
||||||
|
read -r -d '' msg <<-EOF
|
||||||
local.class
|
local.class
|
||||||
local.hostname
|
local.hostname
|
||||||
local.os
|
local.os
|
||||||
|
@ -1194,6 +1203,7 @@ yadm.openssl-old
|
||||||
yadm.openssl-program
|
yadm.openssl-program
|
||||||
yadm.ssh-perms
|
yadm.ssh-perms
|
||||||
EOF
|
EOF
|
||||||
|
printf '%s' "$msg"
|
||||||
}
|
}
|
||||||
|
|
||||||
function introspect_repo() {
|
function introspect_repo() {
|
||||||
|
@ -1201,7 +1211,8 @@ function introspect_repo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function introspect_switches() {
|
function introspect_switches() {
|
||||||
cat <<-EOF
|
local msg
|
||||||
|
read -r -d '' msg <<-EOF
|
||||||
--yadm-archive
|
--yadm-archive
|
||||||
--yadm-bootstrap
|
--yadm-bootstrap
|
||||||
--yadm-config
|
--yadm-config
|
||||||
|
@ -1211,6 +1222,7 @@ function introspect_switches() {
|
||||||
--yadm-repo
|
--yadm-repo
|
||||||
-Y
|
-Y
|
||||||
EOF
|
EOF
|
||||||
|
printf '%s' "$msg"
|
||||||
}
|
}
|
||||||
|
|
||||||
function list() {
|
function list() {
|
||||||
|
@ -1564,7 +1576,8 @@ function issue_legacy_path_warning() {
|
||||||
path_list="$path_list * $legacy_path"$'\n'
|
path_list="$path_list * $legacy_path"$'\n'
|
||||||
done
|
done
|
||||||
|
|
||||||
cat <<EOF >&2
|
local msg
|
||||||
|
IFS='' read -r -d '' msg <<EOF
|
||||||
|
|
||||||
**WARNING**
|
**WARNING**
|
||||||
Legacy paths have been detected.
|
Legacy paths have been detected.
|
||||||
|
@ -1588,7 +1601,7 @@ function issue_legacy_path_warning() {
|
||||||
${path_list}
|
${path_list}
|
||||||
***********
|
***********
|
||||||
EOF
|
EOF
|
||||||
|
printf '%s\n' "$msg" >&2
|
||||||
LEGACY_WARNING_ISSUED=1
|
LEGACY_WARNING_ISSUED=1
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1664,13 +1677,11 @@ function configure_repo() {
|
||||||
|
|
||||||
function set_operating_system() {
|
function set_operating_system() {
|
||||||
|
|
||||||
local proc_version
|
if [[ "$(<$PROC_VERSION)" =~ [Mm]icrosoft ]]; then
|
||||||
proc_version=$(cat "$PROC_VERSION" 2>/dev/null)
|
|
||||||
if [[ "$proc_version" =~ [Mm]icrosoft ]]; then
|
|
||||||
OPERATING_SYSTEM="WSL"
|
OPERATING_SYSTEM="WSL"
|
||||||
else
|
else
|
||||||
OPERATING_SYSTEM=$(uname -s)
|
OPERATING_SYSTEM=$(uname -s)
|
||||||
fi
|
fi 2>/dev/null
|
||||||
|
|
||||||
case "$OPERATING_SYSTEM" in
|
case "$OPERATING_SYSTEM" in
|
||||||
CYGWIN*|MINGW*|MSYS*)
|
CYGWIN*|MINGW*|MSYS*)
|
||||||
|
|
Loading…
Reference in a new issue