mirror of https://github.com/databricks/cli.git
43 lines
1.0 KiB
Plaintext
43 lines
1.0 KiB
Plaintext
errcode() {
|
|
# Temporarily disable 'set -e' to prevent the script from exiting on error
|
|
set +e
|
|
# Execute the provided command with all arguments
|
|
"$@"
|
|
local exit_code=$?
|
|
# Re-enable 'set -e' if it was previously set
|
|
set -e
|
|
>&2 printf "\nExit code: $exit_code\n"
|
|
}
|
|
|
|
trace() {
|
|
>&2 printf "\n>>> %s\n" "$*"
|
|
|
|
if [[ "$1" == *"="* ]]; then
|
|
# If the first argument contains '=', collect all env vars
|
|
local env_vars=()
|
|
while [[ "$1" == *"="* ]]; do
|
|
env_vars+=("$1")
|
|
shift
|
|
done
|
|
# Export environment variables in a subshell and execute the command
|
|
(
|
|
export "${env_vars[@]}"
|
|
"$@"
|
|
)
|
|
else
|
|
# Execute the command normally
|
|
"$@"
|
|
fi
|
|
|
|
return $?
|
|
}
|
|
|
|
git-repo-init() {
|
|
git init -qb main
|
|
git config --global core.autocrlf false
|
|
git config user.name "Tester"
|
|
git config user.email "tester@databricks.com"
|
|
git add databricks.yml
|
|
git commit -qm 'Add databricks.yml'
|
|
}
|