Skip to content

Commit 9e589e5

Browse files
committed
refactor: Convert non-snake case variables to snake-case naming scheme
1 parent b5c3076 commit 9e589e5

16 files changed

+109
-108
lines changed

pkg/lib/commands/do-install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# shellcheck shell=bash
22

33
do-install() {
4-
local with_ssh="no"
4+
local with_ssh='no'
55

66
case "$1" in
77
--ssh)
8-
with_ssh="yes"
8+
with_ssh='yes'
99
shift
1010
;;
1111
esac

pkg/lib/commands/do-link.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# shellcheck shell=bash
22

33
do-link() {
4-
local no_deps="false"
4+
local install_deps='yes'
55

66
case $1 in
77
--no-deps)
8-
no_deps="true"
8+
install_deps='no'
99
shift
1010
;;
1111
esac
@@ -30,7 +30,7 @@ do-link() {
3030
ln -s "$directory" "$BPM_PACKAGES_PATH/$package"
3131

3232
log.info "Linking '$directory'"
33-
if [ "$no_deps" = "false" ]; then
33+
if [ "$install_deps" = 'yes' ]; then
3434
do-plumbing-deps "$package"
3535
fi
3636
do-plumbing-link-bins "$package"

pkg/lib/commands/do-list.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# shellcheck shell=bash
22

33
do-list() {
4-
local shouldShowOutdated=false
4+
local should_show_outdated='no'
55

66
for arg; do
77
case "$arg" in
88
--outdated)
9-
shouldShowOutdated=true
9+
should_show_outdated='yes'
1010
shift
1111
;;
1212
esac
1313
done
1414

15-
if [ "$shouldShowOutdated" = true ]; then
15+
if [ "$should_show_outdated" = 'yes' ]; then
1616
local packages
1717
readarray -t packages < <(do-list)
1818

pkg/lib/commands/do-package-path.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
bpm-package-path() {
44
local package="$1"
5-
ensure.nonZero 'package' "$package"
5+
ensure.non_zero 'package' "$package"
66

77
printf "%s\n" "$BPM_PACKAGES_PATH/$package"
88
}

pkg/lib/commands/do-plumbing-clone.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ do-plumbing-clone() {
55
local package="$2"
66
local ref="$3"
77

8-
ensure.nonZero 'uri' "$uri"
8+
ensure.non_zero 'uri' "$uri"
99

1010
if [ -e "$BPM_PACKAGES_PATH/$package" ]; then
1111
die "Package '$package' is already present"
1212
fi
1313

14-
local -a gitArgs=(--recursive)
14+
local -a git_args=(--recursive)
1515

1616
if [ -z "${BPM_FULL_CLONE+x}" ]; then
17-
gitArgs+=(--depth=1)
17+
git_args+=(--depth=1)
1818
fi
1919

2020
if [ -n "$ref" ]; then
21-
gitArgs+=(--branch "$ref")
21+
git_args+=(--branch "$ref")
2222
fi
2323

24-
gitArgs+=("$uri")
25-
gitArgs+=("$BPM_PACKAGES_PATH/$package")
24+
git_args+=("$uri")
25+
git_args+=("$BPM_PACKAGES_PATH/$package")
2626

2727
log.info "Cloning package '$package'"
28-
git clone "${gitArgs[@]}"
28+
git clone "${git_args[@]}"
2929
}

pkg/lib/commands/do-plumbing-deps.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88

99
do-plumbing-deps() {
1010
local package="$1"
11-
ensure.nonZero 'package' "$package"
12-
ensure.packageExists "$package"
11+
ensure.non_zero 'package' "$package"
12+
ensure.package_exists "$package"
1313

1414
local -a deps=()
1515

16-
local bpmTomlFile="$BPM_PACKAGES_PATH/$package/bpm.toml"
17-
local packageShFile="$BPM_PACKAGES_PATH/$package/package.sh"
16+
local bpm_toml_file="$BPM_PACKAGES_PATH/$package/bpm.toml"
17+
local package_sh_file="$BPM_PACKAGES_PATH/$package/package.sh"
1818

19-
if [ -f "$bpmTomlFile" ]; then
20-
if util.get_toml_array "$bpmTomlFile" 'dependencies'; then
19+
if [ -f "$bpm_toml_file" ]; then
20+
if util.get_toml_array "$bpm_toml_file" 'dependencies'; then
2121
deps=("${REPLIES[@]}")
2222
fi
23-
elif [ -f "$packageShFile" ]; then
24-
if util.extract_shell_variable "$packageShFile" 'DEPS'; then
23+
elif [ -f "$package_sh_file" ]; then
24+
if util.extract_shell_variable "$package_sh_file" 'DEPS'; then
2525
IFS=':' read -ra deps <<< "$REPLY"
2626
fi
2727
fi

pkg/lib/commands/do-plumbing-link-bins.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
do-plumbing-link-bins() {
44
local package="$1"
5-
ensure.nonZero 'package' "$package"
6-
ensure.packageExists "$package"
5+
ensure.non_zero 'package' "$package"
6+
ensure.package_exists "$package"
77

88
log.info "Linking bin files for '$package'"
99

1010
# We want this to be visible to the other functions
1111
declare -g remove_extension=
1212
local -a bins=()
1313

14-
local bpmTomlFile="$BPM_PACKAGES_PATH/$package/bpm.toml"
15-
local packageShFile="$BPM_PACKAGES_PATH/$package/package.sh"
14+
local bpm_toml_file="$BPM_PACKAGES_PATH/$package/bpm.toml"
15+
local package_sh_file="$BPM_PACKAGES_PATH/$package/package.sh"
1616

17-
if [ -f "$bpmTomlFile" ]; then
18-
if util.get_toml_array "$bpmTomlFile" 'binDirs'; then
17+
if [ -f "$bpm_toml_file" ]; then
18+
if util.get_toml_array "$bpm_toml_file" 'binDirs'; then
1919
for dir in "${REPLIES[@]}"; do
2020
for file in "$BPM_PACKAGES_PATH/$package/$dir"/*; do
2121
symlink_binfile "$file"
@@ -24,12 +24,12 @@ do-plumbing-link-bins() {
2424
else
2525
fallback_symlink_bins "$package"
2626
fi
27-
elif [ -f "$packageShFile" ]; then
28-
if util.extract_shell_variable "$packageShFile" 'REMOVE_EXTENSION'; then
27+
elif [ -f "$package_sh_file" ]; then
28+
if util.extract_shell_variable "$package_sh_file" 'REMOVE_EXTENSION'; then
2929
remove_extension="$REPLY"
3030
fi
3131

32-
if util.extract_shell_variable "$packageShFile" 'BINS'; then
32+
if util.extract_shell_variable "$package_sh_file" 'BINS'; then
3333
IFS=':' read -ra bins <<< "$REPLY"
3434

3535
for file in "${bins[@]}"; do

pkg/lib/commands/do-plumbing-link-completions.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
do-plumbing-link-completions() {
44
local package="$1"
5-
ensure.nonZero 'package' "$package"
6-
ensure.packageExists "$package"
5+
ensure.non_zero 'package' "$package"
6+
ensure.package_exists "$package"
77

88
log.info "Linking completion files for '$package'"
99

1010
local -a bash_completion_files=() zsh_completion_files=()
1111

12-
local bpmTomlFile="$BPM_PACKAGES_PATH/$package/bpm.toml"
13-
local packageShFile="$BPM_PACKAGES_PATH/$package/package.sh"
12+
local bpm_toml_file="$BPM_PACKAGES_PATH/$package/bpm.toml"
13+
local package_sh_file="$BPM_PACKAGES_PATH/$package/package.sh"
1414

1515
# Get completion directories
16-
if [ -f "$bpmTomlFile" ]; then
17-
if util.get_toml_array "$bpmTomlFile" 'completionDirs'; then
16+
if [ -f "$bpm_toml_file" ]; then
17+
if util.get_toml_array "$bpm_toml_file" 'completionDirs'; then
1818
local -a newCompletions=()
1919

2020
for dir in "${REPLIES[@]}"; do
@@ -25,29 +25,29 @@ do-plumbing-link-completions() {
2525
bash_completion_files+=("${newCompletions[@]}")
2626
zsh_completion_files+=("${newCompletions[@]}")
2727
else
28-
auto-collect-completion_files "$package"
28+
auto_collect_completion_files "$package"
2929
REPLIES1=("${REPLIES1[@]/#/"$BPM_PACKAGES_PATH/$package/"}")
3030
REPLIES2=("${REPLIES2[@]/#/"$BPM_PACKAGES_PATH/$package/"}")
3131

3232
bash_completion_files+=("${REPLIES1[@]}")
3333
zsh_completion_files+=("${REPLIES2[@]}")
3434
fi
35-
elif [ -f "$packageShFile" ]; then
36-
if util.extract_shell_variable "$packageShFile" 'BASH_COMPLETIONS'; then
35+
elif [ -f "$package_sh_file" ]; then
36+
if util.extract_shell_variable "$package_sh_file" 'BASH_COMPLETIONS'; then
3737
IFS=':' read -ra bash_completion_files <<< "$REPLY"
3838
else
39-
auto-collect-completion_files "$package"
39+
auto_collect_completion_files "$package"
4040
bash_completion_files+=("${REPLIES1[@]}")
4141
fi
4242

43-
if util.extract_shell_variable "$packageShFile" 'ZSH_COMPLETIONS'; then
43+
if util.extract_shell_variable "$package_sh_file" 'ZSH_COMPLETIONS'; then
4444
IFS=':' read -ra zsh_completion_files <<< "$REPLY"
4545
else
46-
auto-collect-completion_files "$package"
46+
auto_collect_completion_files "$package"
4747
zsh_completion_files+=("${REPLIES2[@]}")
4848
fi
4949
else
50-
auto-collect-completion_files "$package"
50+
auto_collect_completion_files "$package"
5151
REPLIES1=("${REPLIES1[@]/#/"$BPM_PACKAGES_PATH/$package/"}")
5252
REPLIES2=("${REPLIES2[@]/#/"$BPM_PACKAGES_PATH/$package/"}")
5353
bash_completion_files+=("${REPLIES1[@]}")
@@ -77,22 +77,22 @@ do-plumbing-link-completions() {
7777
done
7878
}
7979

80-
auto-collect-completion_files() {
80+
auto_collect_completion_files() {
8181
declare -ga REPLIES=()
8282

8383
local package="$1"
8484

8585
local -a bash_completion_files=() zsh_completion_files=()
8686

87-
for completionDir in completion completions contrib/completion contrib/completions; do
88-
local completionDir="$BPM_PACKAGES_PATH/$package/$completionDir"
87+
for completion_dir in completion completions contrib/completion contrib/completions; do
88+
local completion_dir="$BPM_PACKAGES_PATH/$package/$completion_dir"
8989

9090
# TODO: optimize
91-
for target in "$completionDir"/?*.{sh,bash}; do
91+
for target in "$completion_dir"/?*.{sh,bash}; do
9292
bash_completion_files+=("$target")
9393
done
9494

95-
for target in "$completionDir"/?*.zsh; do
95+
for target in "$completion_dir"/?*.zsh; do
9696
zsh_completion_files+=("$target")
9797
done
9898
done

pkg/lib/commands/do-plumbing-link-man.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
do-plumbing-link-man() {
44
local package="$1"
5-
ensure.nonZero 'package' "$package"
6-
ensure.packageExists "$package"
5+
ensure.non_zero 'package' "$package"
6+
ensure.package_exists "$package"
77

88
# TODO: only print when actually linking
99
log.info "Linking man files for '$package'"
1010

11-
local bpmTomlFile="$BPM_PACKAGES_PATH/$package/bpm.toml"
11+
local bpm_toml_file="$BPM_PACKAGES_PATH/$package/bpm.toml"
1212

13-
if [ -f "$bpmTomlFile" ]; then
14-
if util.get_toml_array "$bpmTomlFile" 'manDirs'; then
13+
if [ -f "$bpm_toml_file" ]; then
14+
if util.get_toml_array "$bpm_toml_file" 'manDirs'; then
1515
for dir in "${REPLIES[@]}"; do
16-
local fullDir="$BPM_PACKAGES_PATH/$package/$dir"
16+
local full_dir="$BPM_PACKAGES_PATH/$package/$dir"
1717

1818
# 'file' can be
1919
# 1. A man file
2020
# 2. A directory (man1, man2), that contains man files
21-
for file in "$fullDir"/*; do
21+
for file in "$full_dir"/*; do
2222
if [ -f "$file" ]; then
23-
symlink-manfile "$file"
23+
symlink_manfile "$file"
2424
elif [ -d "$file" ]; then
2525
:
2626
# TODO: Implement 2
@@ -39,20 +39,20 @@ do-plumbing-link-man() {
3939
# the user does not supply any man files/dirs with any config
4040
fallback_symlink_mans() {
4141
for file in "$BPM_PACKAGES_PATH/$package"/{,man/}*; do
42-
symlink-manfile "$file"
42+
symlink_manfile "$file"
4343
done
4444
}
4545

4646
# @arg $1 The man file to symlink
47-
symlink-manfile() {
48-
local fullManFile="$1"
47+
symlink_manfile() {
48+
local full_man_file="$1"
4949

50-
local manFile="${fullManFile##*/}"
50+
local manFile="${full_man_file##*/}"
5151

5252
local regex="\.([1-9])\$"
53-
if [[ "$fullManFile" =~ $regex ]]; then
53+
if [[ "$full_man_file" =~ $regex ]]; then
5454
local n="${BASH_REMATCH[1]}"
5555
mkdir -p "$BPM_INSTALL_MAN/man$n"
56-
ln -sf "$fullManFile" "$BPM_INSTALL_MAN/man$n/$manFile"
56+
ln -sf "$full_man_file" "$BPM_INSTALL_MAN/man$n/$manFile"
5757
fi
5858
}

pkg/lib/commands/do-plumbing-unlink-bins.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
do-plumbing-unlink-bins() {
44
local package="$1"
5-
ensure.nonZero 'package' "$package"
5+
ensure.non_zero 'package' "$package"
66

77
log.info "Unlinking bin files for '$package'"
88

99
local -a bins=()
1010
local remove_extension=
1111

12-
local packageShFile="$BPM_PACKAGES_PATH/$package/package.sh"
13-
if [ -f "$packageShFile" ]; then
14-
if util.extract_shell_variable "$packageShFile" 'BINS'; then
12+
local package_sh_file="$BPM_PACKAGES_PATH/$package/package.sh"
13+
if [ -f "$package_sh_file" ]; then
14+
if util.extract_shell_variable "$package_sh_file" 'BINS'; then
1515
IFS=':' read -ra bins <<< "$REPLY"
1616
fi
1717

18-
if util.extract_shell_variable "$packageShFile" 'REMOVE_EXTENSION'; then
18+
if util.extract_shell_variable "$package_sh_file" 'REMOVE_EXTENSION'; then
1919
remove_extension="$REPLY"
2020
fi
2121
fi

0 commit comments

Comments
 (0)