Skip to content
This repository has been archived by the owner on Aug 9, 2019. It is now read-only.

Make yaourt input behaviour consistent with pacman #230

Merged
merged 1 commit into from
Mar 6, 2016
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
4 changes: 2 additions & 2 deletions src/lib/abs.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ display_update() {
SP_ARG="" sync_packages "$YAOURTTMPDIR/sysuplist"
return 2
;;
N) return 1;;
*) break;;
Y) break;;
*) return 1;;
esac
done
}
Expand Down
5 changes: 4 additions & 1 deletion src/lib/alpm_query.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ search_pkgs_which() {

# searching for packages installed as dependecy from another packages, but not required anymore
search_forgotten_orphans() {
local answer

AURSEARCH=0 search 0 1; ret=$?
[[ ! $PKGSFOUND ]] && return $ret
prompt "$(gettext 'Do you want to remove these packages (with -Rcs options) ? ') $(yes_no 2)"
useragrees "YN" "N" || su_pacman -Rcs "${PKGSFOUND[@]#*/}"
answer=$(userinput "YN" "N")
[[ $answer = "Y" ]] && su_pacman -Rcs "${PKGSFOUND[@]#*/}"
}

# vim: set ts=4 sw=4 noet:
7 changes: 5 additions & 2 deletions src/lib/io.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ userinput() {
answer=$default
else
read -en $NOENTER
[[ $REPLY ]] && answer=$(echo ${REPLY^^*} | tr "$(gettext $_key)" "$_key") || answer=$default
[[ "${_key/$answer/}" = "$_key" ]] && answer=$default
if [[ $REPLY ]]; then
answer=$(echo ${REPLY^^*} | tr "$(gettext $_key)" "$_key")
else
answer=$default
fi
fi
echo $answer
[[ "$answer" = "$default" ]]
Expand Down
18 changes: 11 additions & 7 deletions src/lib/pkgbuild.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ install_package() {
fi
echo
;;
N) failed=1; break;;
*) break;;
Y) break;;
*) failed=1; break;;
esac
done
(( ! failed )) &&
Expand Down Expand Up @@ -374,11 +374,11 @@ custom_pkg() {
# on success, call install_package
# Usage: package_loop ($pkgname, $trust)
# $pkgname: name of package
# $trust: 1: default answer for editing: Y (for abs)
# $trust: 1: default answer for editing: N (for abs)
package_loop() {
local pl_pkgname=$1
local trust=${2:-0}
local default_answer=1
local answer default_answer=1
local ret=0 failed=0
declare -a PKGBUILD_DEPS PKGBUILD_DEPS_INSTALLED \
PKGBUILD_CONFLICTS PKGBUILD_VARS
Expand All @@ -396,7 +396,8 @@ package_loop() {
case "$ret" in
0|2) break ;;
1) prompt "$(_gettext 'Restart building %s ? ' "$pl_pkgname")$(yes_no 2)"
builduseragrees "YN" "N" && { failed=1; break; }
answer=$(builduserinput "YN" "N")
[[ $answer = "Y" ]] || { failed=1; break; }
;;
*) return 99 ;; # should never execute
esac
Expand Down Expand Up @@ -455,8 +456,11 @@ get_pkgbuild() {
local newdir=$(mktemp --dry-run --tmpdir="." "$pkgdir.XXX")
prompt2 "$(_gettext '%s directory already exist. [R]eplace, [C]hange to %s, [S]kip ?' "$pkgdir" "$newdir")"
local answer=$(userinput "RCS" "R")
[[ $answer = "S" ]] && continue
[[ $answer = "C" ]] && pkgdir=$newdir
case $answer in
R) :;;
C) pkgdir=$newdir;;
*) continue;;
esac
fi
mkdir -p "$pkgdir"
cd "$pkgdir" || continue
Expand Down
3 changes: 1 addition & 2 deletions src/pacdiffviewer.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,9 @@ suppress() {
prompt "$(gettext 'Do you want to delete these files ?') $(\
yes_no 2) $(gettext '(S: no confirm)')"
local answer=$(userinput "YNS" "N")
[[ "$answer" = "N" ]] && return
local _opt=""
[[ "$answer" = "Y" ]] && _opt="-i"
rm $_opt "${pacfiles[@]}"
[[ "$answer" = "Y" ]] || [[ "$answer" = "S" ]] && rm $_opt "${pacfiles[@]}"
}

# Manage .pac* file
Expand Down