Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions bin/basectl
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ basectl_ensure_supported_bash() {
[[ -x "$candidate" ]] || continue
[[ "$candidate" == "${BASH:-}" ]] && continue
basectl_rosetta_bash_candidate_allowed "$candidate" || continue
# shellcheck disable=SC2093 # Intentional one-shot re-exec under the selected Bash.
exec "$candidate" "$0" "$@"
done

Expand All @@ -170,6 +171,7 @@ basectl_ensure_supported_bash() {
for candidate in "${candidates[@]}"; do
[[ -x "$candidate" ]] || continue
[[ "$candidate" == "${BASH:-}" ]] && continue
# shellcheck disable=SC2093 # Intentional one-shot re-exec under a supported Bash.
exec "$candidate" "$0" "$@"
done

Expand Down Expand Up @@ -249,6 +251,7 @@ basectl_run_bash_script() {
export BASE_BASH_COMMAND_DIR="$command_dir"
export BASE_BASH_COMMAND_SCRIPT="$script_path"

# shellcheck disable=SC2034 # Consumed by base_init.sh during this source call.
BASE_BASH_BOOTSTRAP_SOURCE="$script_path"
# shellcheck source=/dev/null
source "$base_home/base_init.sh" "$@" || exit $?
Expand Down
4 changes: 2 additions & 2 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ bootstrap_expand_path() {
local path="$1"

case "$path" in
"~") printf '%s\n' "$HOME" ;;
"~/"*) printf '%s/%s\n' "$HOME" "${path#"~/"}" ;;
\~) printf '%s\n' "$HOME" ;;
\~/*) printf '%s/%s\n' "$HOME" "${path#\~/}" ;;
*) printf '%s\n' "$path" ;;
esac
}
Expand Down
2 changes: 2 additions & 0 deletions cli/bash/commands/basectl/basectl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ basectl_verify_home() {
local file missing=()

if [[ ! -d "$base_home" ]]; then
# shellcheck disable=SC2034 # Read by the caller after this helper returns non-zero.
BASE_CLI_ERROR_MESSAGE="Base home '$base_home' is not a directory."
return 1
fi
Expand All @@ -220,6 +221,7 @@ basectl_verify_home() {
done

if (( ${#missing[@]} > 0 )); then
# shellcheck disable=SC2034 # Read by the caller after this helper returns non-zero.
BASE_CLI_ERROR_MESSAGE="Files missing in Base home '$base_home': ${missing[*]}"
return 1
fi
Expand Down
1 change: 1 addition & 0 deletions cli/bash/commands/basectl/subcommands/export_context.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ base_export_context_subcommand_main() {
local resolve_args=() exporter_args=()
local resolve_fields=()
local arg
# shellcheck disable=SC2034 # Passed by name to cli_parse_options.
local -a option_specs=(
"debug|flag|-v"
"workspace|value|--workspace"
Expand Down
1 change: 1 addition & 0 deletions cli/bash/commands/basectl/subcommands/gh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,7 @@ base_gh_issue_default_assignee_from_config() {

base_gh_join_csv() {
local joined=""
# shellcheck disable=SC2034 # Passed by name to str_join.
local values=("$@")

str_join joined ", " values
Expand Down
6 changes: 4 additions & 2 deletions cli/bash/commands/basectl/subcommands/onboard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,16 @@ base_onboard_read_prompt_answer() {
local tty_fd="${BASE_ONBOARD_TTY_FD:-}"
local tty_path="${BASE_ONBOARD_TTY_PATH:-/dev/tty}"

[[ -n "$answer_var" ]] || return 1

if [[ -n "$tty_fd" ]]; then
[[ "$tty_fd" =~ ^[0-9]+$ ]] || return 1
IFS= read -r -u "$tty_fd" "$answer_var"
IFS= read -r -u "$tty_fd" "${answer_var:?}"
return $?
fi

[[ -r "$tty_path" ]] || return 1
IFS= read -r "$answer_var" < "$tty_path"
IFS= read -r "${answer_var:?}" < "$tty_path"
}

base_onboard_prompt() {
Expand Down
1 change: 1 addition & 0 deletions cli/bash/commands/basectl/subcommands/repo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1260,6 +1260,7 @@ base_repo_pretty_command() {

base_repo_join_csv() {
local joined=""
# shellcheck disable=SC2034 # Passed by name to str_join.
local values=("$@")

str_join joined ", " values
Expand Down
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ install_die() {
install_expand_path() {
local path="$1"
case "$path" in
"~") printf '%s\n' "$HOME" ;;
"~/"*) printf '%s/%s\n' "$HOME" "${path#"~/"}" ;;
\~) printf '%s\n' "$HOME" ;;
\~/*) printf '%s/%s\n' "$HOME" "${path#\~/}" ;;
*) printf '%s\n' "$path" ;;
esac
}
Expand Down
11 changes: 6 additions & 5 deletions lib/shell/base_platform_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,23 @@ base_platform_tools_set_ordered_path() {
local base_bin="${1:-}"
local platform_tools_bin="${2:-}"
local project_bin="${3:-}"
local new_path=""
local rest_path

rest_path="$(base_platform_tools_path_without_entries "$base_bin" "$platform_tools_bin" "$project_bin" "${PATH:-}")"

PATH=""
if [[ -n "$base_bin" && -d "$base_bin" ]]; then
PATH="$base_bin"
new_path="$base_bin"
fi
if [[ -n "$platform_tools_bin" && -d "$platform_tools_bin" ]]; then
PATH="${PATH:+$PATH:}$platform_tools_bin"
new_path="${new_path:+$new_path:}$platform_tools_bin"
fi
if [[ -n "$project_bin" && -d "$project_bin" ]]; then
PATH="${PATH:+$PATH:}$project_bin"
new_path="${new_path:+$new_path:}$project_bin"
fi
if [[ -n "$rest_path" ]]; then
PATH="${PATH:+$PATH:}$rest_path"
new_path="${new_path:+$new_path:}$rest_path"
fi
PATH="$new_path"
export PATH
}
1 change: 1 addition & 0 deletions lib/shell/bash_profile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# shellcheck shell=bash
#
# bash_profile
# Base-managed login-shell snippet for Bash.
Expand Down
1 change: 1 addition & 0 deletions lib/shell/bashrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# shellcheck shell=bash
#
# bashrc
# Base-managed interactive-shell integration for Bash dotfiles.
Expand Down
1 change: 1 addition & 0 deletions lib/shell/zsh_defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,5 @@ setopt no_beep
setopt prompt_subst
setopt share_history

# shellcheck disable=SC2034 # Consumed by zsh as the interactive prompt.
PROMPT='%* %m $(_base_zsh_defaults_git_prompt)%1~: '
Loading