mirror of
https://github.com/sbopkg/sbopkg
synced 2024-11-10 03:50:33 +03:00
generalize view_readmes()
view_readmes() now takes two arguments for header text and input, doesn't bother displaying 'DISABLED' packages if not displaying from a queue, and has a fuzzier dialog title.
This commit is contained in:
parent
6389034312
commit
31b07d91cc
@ -2083,7 +2083,7 @@ view_queue() {
|
|||||||
uncheck_installed $TMPQUEUE
|
uncheck_installed $TMPQUEUE
|
||||||
;;
|
;;
|
||||||
3) # View READMEs
|
3) # View READMEs
|
||||||
view_readmes
|
view_readmes "The active queue is:" $TMPQUEUE
|
||||||
;;
|
;;
|
||||||
*) # Cancel or ESC
|
*) # Cancel or ESC
|
||||||
mv $ORIGINALQUEUE $TMPQUEUE
|
mv $ORIGINALQUEUE $TMPQUEUE
|
||||||
@ -2095,23 +2095,28 @@ view_queue() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
view_readmes() {
|
view_readmes() {
|
||||||
# Show a list of all README files for the queued (TMPQUEUE) packages.
|
# Show a list of all README files for $INPUT. Takes two arguments, the
|
||||||
|
# first of which will serve as header text and the second of which
|
||||||
|
# specifies the input (list of packages whose READMEs are to be
|
||||||
|
# displayed).
|
||||||
|
|
||||||
|
local HEADER_STRING=$1
|
||||||
|
local INPUT=$2
|
||||||
local READMES_FILE=$SBOPKGTMP/sbopkg-all-readmes
|
local READMES_FILE=$SBOPKGTMP/sbopkg-all-readmes
|
||||||
local HEAD_FILE=$SBOPKGTMP/sbopkg-all-readmes-head
|
local HEAD_FILE=$SBOPKGTMP/sbopkg-all-readmes-head
|
||||||
local REPORT_FILE=$SBOPKGTMP/sbopkg-all-readmes-report
|
local REPORT_FILE=$SBOPKGTMP/sbopkg-all-readmes-report
|
||||||
local NAME ONOFF
|
local NAME ONOFF PICK READMES
|
||||||
local PICK READMES
|
|
||||||
|
|
||||||
READMES=$(find $REPO_DIR -name README)
|
READMES=$(find $REPO_DIR -name README)
|
||||||
|
|
||||||
echo -e "The active queue is:\n" > $HEAD_FILE
|
printf "$HEADER_STRING\n" > $HEAD_FILE
|
||||||
|
|
||||||
while read PICK; do
|
while read PICK; do
|
||||||
NAME=${PICK/ *}
|
NAME=${PICK/ *}
|
||||||
ONOFF=${PICK/* }
|
ONOFF=${PICK/* }
|
||||||
|
|
||||||
if [[ $ONOFF =~ [Oo][Nn] ]]; then
|
# if not reading from TMPQUEUE, just pass everything through
|
||||||
|
if [[ $ONOFF =~ ^[Oo][Nn]$ ]] || [[ $INPUT != $TMPQUEUE ]]; then
|
||||||
echo $NAME >> $HEAD_FILE
|
echo $NAME >> $HEAD_FILE
|
||||||
else
|
else
|
||||||
echo "$NAME (DISABLED)" >> $HEAD_FILE
|
echo "$NAME (DISABLED)" >> $HEAD_FILE
|
||||||
@ -2122,13 +2127,13 @@ view_readmes() {
|
|||||||
tin_text $NAME >> $READMES_FILE
|
tin_text $NAME >> $READMES_FILE
|
||||||
echo >> $READMES_FILE
|
echo >> $READMES_FILE
|
||||||
cat $(grep /$NAME/README\$ <<< "$READMES") >> $READMES_FILE
|
cat $(grep /$NAME/README\$ <<< "$READMES") >> $READMES_FILE
|
||||||
done < $TMPQUEUE
|
done < $INPUT
|
||||||
|
|
||||||
tin_text "$(< $HEAD_FILE)" > $REPORT_FILE
|
tin_text "$(< $HEAD_FILE)" > $REPORT_FILE
|
||||||
cat $READMES_FILE >> $REPORT_FILE
|
cat $READMES_FILE >> $REPORT_FILE
|
||||||
|
|
||||||
if [[ $DIAG ]]; then
|
if [[ $DIAG ]]; then
|
||||||
dialog --exit-label "OK" --title "READMEs for the queued packages" \
|
dialog --exit-label "OK" --title "Showing READMEs" \
|
||||||
--textbox $REPORT_FILE 0 0
|
--textbox $REPORT_FILE 0 0
|
||||||
else
|
else
|
||||||
$PAGER $REPORT_FILE
|
$PAGER $REPORT_FILE
|
||||||
@ -4699,7 +4704,7 @@ else
|
|||||||
fi
|
fi
|
||||||
# Preview READMEs
|
# Preview READMEs
|
||||||
if [[ $PREVIEW_READMES ]]; then
|
if [[ $PREVIEW_READMES ]]; then
|
||||||
view_readmes
|
view_readmes "The active queue is:" $TMPQUEUE
|
||||||
echo
|
echo
|
||||||
while :; do
|
while :; do
|
||||||
read $NFLAG -ep "(C)ontinue processing or (Q)uit?: "
|
read $NFLAG -ep "(C)ontinue processing or (Q)uit?: "
|
||||||
|
Loading…
Reference in New Issue
Block a user