newsboat: show queries before urls

PR #1047
This commit is contained in:
Martin Potier 2020-02-21 13:02:33 +02:00 committed by Robert Helgesson
parent 03b622b356
commit ef148ab3cb
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
5 changed files with 50 additions and 2 deletions

View file

@ -81,3 +81,6 @@ changes are only active if the `home.stateVersion` option is set to
using the xdg module. Also, the default value is fixed to
`$HOME/.zsh_history` and `dotDir` path is not prepended to it
anymore.
* The newsboat module will now default in displaying `queries` before `urls` in
its main window. This makes sense in the case when one has a lot of URLs and
few queries.

View file

@ -102,7 +102,11 @@ in {
mkQueryEntry = n: v: ''"query:${n}:${escape [ ''"'' ] v}"'';
queries = mapAttrsToList mkQueryEntry cfg.queries;
in concatStringsSep "\n" (urls ++ queries) + "\n";
in concatStringsSep "\n"
(if versionAtLeast config.home.stateVersion "20.03" then
queries ++ urls
else
urls ++ queries) + "\n";
home.file.".newsboat/config".text = ''
max-items ${toString cfg.maxItems}

View file

@ -1 +1,4 @@
{ newsboat-basics = ./newsboat-basics.nix; }
{
newsboat-basics = ./newsboat-basics.nix;
newsboat-basics-2003 = ./newsboat-basics-2003.nix;
}

View file

@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
with lib;
{
config = {
home.stateVersion = "20.03";
programs.newsboat = {
enable = true;
urls = [
{
url = "http://example.org/feed.xml";
tags = [ "tag1" "tag2" ];
title = "Cool feed";
}
{ url = "http://example.org/feed2.xml"; }
];
queries = { "foo" = ''rssurl =~ "example.com"''; };
};
nixpkgs.overlays = [
(self: super: { newsboat = pkgs.writeScriptBin "dummy-newsboat" ""; })
];
nmt.script = ''
assertFileContent \
home-files/.newsboat/urls \
${./newsboat-basics-urls-2003.txt}
'';
};
}

View file

@ -0,0 +1,3 @@
"query:foo:rssurl =~ \"example.com\""
http://example.org/feed.xml "tag1" "tag2" "~Cool feed"
http://example.org/feed2.xml