home-manager: make show news a bit more robust
This commit is contained in:
parent
59a4c43e9b
commit
5518f9d439
1 changed files with 6 additions and 6 deletions
|
@ -807,23 +807,23 @@ function doShowNews() {
|
||||||
local readIdsFile
|
local readIdsFile
|
||||||
readIdsFile="$(newsReadIdsFile)"
|
readIdsFile="$(newsReadIdsFile)"
|
||||||
|
|
||||||
local news
|
local newsAttr
|
||||||
|
|
||||||
# shellcheck disable=2154,2046
|
|
||||||
case $1 in
|
case $1 in
|
||||||
--all)
|
--all)
|
||||||
news="$(nix-instantiate --quiet --eval --expr "(import ${newsNixFile}).news.all")"
|
newsAttr="all"
|
||||||
;;
|
;;
|
||||||
--unread)
|
--unread)
|
||||||
news="$(nix-instantiate --quiet --eval --expr "(import ${newsNixFile}).news.unread")"
|
newsAttr="unread"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
_i 'Unknown argument %s' "$1"
|
_i 'Unknown argument %s' "$1"
|
||||||
return 1
|
return 1
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Prints the news without surrounding quotes.
|
nix-instantiate --quiet --eval --json --expr "(import ${newsNixFile}).news.$newsAttr" \
|
||||||
echo -e "${news:1:-1}" | ${PAGER:-less}
|
| jq -r . \
|
||||||
|
| ${PAGER:-less}
|
||||||
|
|
||||||
local allIds
|
local allIds
|
||||||
allIds="$(nix-instantiate --quiet --eval --expr "(import ${newsNixFile}).meta.ids")"
|
allIds="$(nix-instantiate --quiet --eval --expr "(import ${newsNixFile}).meta.ids")"
|
||||||
|
|
Loading…
Reference in a new issue