Skip to content

Commit 4e73bb9

Browse files
committed
refactor
- avoid `target` prefix as it reminds me of `target/` too much
1 parent ec2427f commit 4e73bb9

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

etc/copy-packetline.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
set -euC -o pipefail
44

55
readonly source_dir='gix-packetline/src'
6-
readonly target_parent_dir='gix-packetline-blocking'
7-
readonly target_dir="$target_parent_dir/src"
6+
readonly destination_parent_dir='gix-packetline-blocking'
7+
readonly destination_dir="$destination_parent_dir/src"
88

99
function fail () {
1010
printf '%s: error: %s\n' "$0" "$1" >&2
@@ -34,12 +34,12 @@ function merging () {
3434
}
3535

3636
function target_dir_status () {
37-
git status --porcelain --ignored=traditional -- "$target_dir" ||
37+
git status --porcelain --ignored=traditional -- "$destination_dir" ||
3838
fail 'git-status failed'
3939
}
4040

41-
function check_target_dir () {
42-
if ! test -e "$target_dir"; then
41+
function check_destination_dir () {
42+
if ! test -e "$destination_dir"; then
4343
# The target does not exist on disk, so nothing will be lost. Proceed.
4444
return
4545
fi
@@ -111,7 +111,7 @@ function generate_one () {
111111
local source_file target_file
112112

113113
source_file="$1"
114-
target_file="$target_dir${source_file#"$source_dir"}"
114+
target_file="$destination_dir${source_file#"$source_dir"}"
115115

116116
if test -d "$source_file"; then
117117
mkdir -p -- "$target_file"
@@ -134,13 +134,13 @@ function generate_all () {
134134
if ! test -d "$source_dir"; then
135135
fail "no source directory: $source_dir"
136136
fi
137-
if ! test -d "$target_parent_dir"; then
138-
fail "no target parent directory: $target_parent_dir"
137+
if ! test -d "$destination_parent_dir"; then
138+
fail "no target parent directory: $destination_parent_dir"
139139
fi
140-
check_target_dir
140+
check_destination_dir
141141

142-
rm -rf -- "$target_dir" # It may be a directory, symlink, or regular file.
143-
if test -e "$target_dir"; then
142+
rm -rf -- "$destination_dir" # It may be a directory, symlink, or regular file.
143+
if test -e "$destination_dir"; then
144144
fail 'unable to remove target location'
145145
fi
146146

0 commit comments

Comments
 (0)