diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/deb.sh | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -95,6 +95,20 @@ config_save() done > "${DEB_DIR}/config" } +prompt_bool() +{ + _def="${1}" + _prompt="${2}" + shift 2 + [ "${_def}" = y ] && _yn='[Y/n]' || _yn='[y/N]' + printf "${_prompt} ${_yn} " $@ + + read _val + [ "${_val}" = y ] && return 0 + [ "${_val}" = n ] && return 1 + [ "${_def}" = y ] && return 0 || return 1 +} + cmd_run() { "cmd_${COMMAND_NAME}" ${@} @@ -114,6 +128,7 @@ cmd_init() cd "${DEB_TREE}" if [ -d .deb ]; then + prompt_bool n 'DEB work area exists. Reinitialize?' || exit rm -Rf .deb dsc builds pkgs work mkdir .deb dsc builds pkgs work config_save |