Lines 1-5
Link Here
|
1 |
# -*-eselect-*- vim: ft=eselect |
1 |
# -*-eselect-*- vim: ft=eselect |
2 |
# Copyright 2005-2020 Gentoo Authors |
2 |
# Copyright 2005-2021 Gentoo Authors |
3 |
# Distributed under the terms of the GNU GPL version 2 or later |
3 |
# Distributed under the terms of the GNU GPL version 2 or later |
4 |
|
4 |
|
5 |
inherit package-manager |
5 |
inherit package-manager |
Lines 171-186
describe_list() {
Link Here
|
171 |
echo "List news items" |
171 |
echo "List news items" |
172 |
} |
172 |
} |
173 |
|
173 |
|
|
|
174 |
describe_list_options() { |
175 |
echo "new : List unread news items" |
176 |
echo "all : List all news items (default)" |
177 |
} |
178 |
|
174 |
do_list() { |
179 |
do_list() { |
175 |
local item stat repo dir header line format title posted i=1 |
180 |
local item stat repo dir header line format title posted unread i=0 n=0 |
176 |
local cols=${COLUMNS:-80} ifs_save=${IFS} |
181 |
local cols=${COLUMNS:-80} ifs_save=${IFS} |
177 |
local -a repos dirs |
182 |
local -a repos dirs |
178 |
|
183 |
|
|
|
184 |
case $1 in |
185 |
new) unread=1 ;; |
186 |
all|"") ;; |
187 |
*) write_warning_msg "Bad option: $1" ;; |
188 |
esac |
189 |
|
179 |
set -- $(find_items unread read) |
190 |
set -- $(find_items unread read) |
180 |
write_list_start "News items:" |
191 |
write_list_start "News items:" |
181 |
for item; do |
192 |
for item; do |
|
|
193 |
(( i++ )) |
182 |
stat=${item%%/*}; item=${item#*/} |
194 |
stat=${item%%/*}; item=${item#*/} |
183 |
repo=${item%%/*}; item=${item#*/} |
195 |
repo=${item%%/*}; item=${item#*/} |
|
|
196 |
[[ ! ${unread} || ${stat} = unread ]] || continue |
197 |
(( n++ )) |
184 |
find_repo_dir "${repo}" |
198 |
find_repo_dir "${repo}" |
185 |
title="(${item} - no title)" |
199 |
title="(${item} - no title)" |
186 |
posted=${item:0:10} |
200 |
posted=${item:0:10} |
Lines 215-223
do_list() {
Link Here
|
215 |
else |
229 |
else |
216 |
write_numbered_list_entry ${i} " ${line}" |
230 |
write_numbered_list_entry ${i} " ${line}" |
217 |
fi |
231 |
fi |
218 |
(( i++ )) |
|
|
219 |
done |
232 |
done |
220 |
[[ $# -eq 0 ]] && ! is_output_mode brief \ |
233 |
[[ ${n} -eq 0 ]] && ! is_output_mode brief \ |
221 |
&& write_kv_list_entry "(none found)" "" |
234 |
&& write_kv_list_entry "(none found)" "" |
222 |
} |
235 |
} |
223 |
|
236 |
|