Fix build-dir not stooping on error, remove build-dir.py

This commit is contained in:
2018-09-03 11:32:29 +01:00
parent 6a4531423e
commit 2589b63023
2 changed files with 10 additions and 53 deletions

View File

@@ -37,15 +37,18 @@ optional arguments:
EOF
return
fi
error() { echo "\e[31merror:\e[0m $1"; return 1 }
error() { echo "\e[31merror:\e[0m $1" }
warning() { echo "\e[33mwarning:\e[0m $1" }
local build_dir
if [[ ${#*} -gt 1 ]]; then
echo $usage
error "unexpected position arguments: ${*[2,${#*}]}"
error "unexpected position arguments: ${*[2,${#*}]}"; return 1
elif [[ ${#*} -eq 1 ]]; then
build_dir=${*[1]}
[[ ! -d $build_dir ]] && \
error "directory not found: $build_dir"
if [[ ! -d ${*[1]} ]]; then
warning "directory not found: ${*[1]}"
else
build_dir=${*[1]}
fi
fi
# If <directory> was not set begin selection
@@ -60,7 +63,7 @@ EOF
# Interactively select a build directory if more than 1 found
integer index=0
if [[ ${#build_dirs} -eq 0 ]]; then
error "no build directories found"
error "no build directories found"; return 1
elif [[ ${#build_dirs} -gt 1 ]]; then
zmodload zsh/curses && {
# Get the size of the terminal
@@ -139,7 +142,7 @@ EOF
# If the build variable is not defined the command could not be determined
if [ -z $build ]; then
echo "\e[33mwarning:\e[0m build command detection failed: $build_dir"
warning "build command detection failed: $build_dir"
# Prompt user to enter a build command
vared -p 'enter comand: ' build
fi