diff options
author | Martin Potier <martin.potier@marvid.fr> | 2020-02-21 13:02:33 +0200 |
---|---|---|
committer | Robert Helgesson <robert@rycee.net> | 2020-02-26 21:38:07 +0100 |
commit | ef148ab3cb015be98c795b89b9aff2afe4fff4a1 (patch) | |
tree | 0162944c052efe7a376da251fa7e1bd2255588e5 | |
parent | 03b622b35685522749fd54eeb06bf08d78d9b4f3 (diff) |
newsboat: show queries before urls
PR #1047
-rw-r--r-- | doc/release-notes/rl-2003.adoc | 3 | ||||
-rw-r--r-- | modules/programs/newsboat.nix | 6 | ||||
-rw-r--r-- | tests/modules/programs/newsboat/default.nix | 5 | ||||
-rw-r--r-- | tests/modules/programs/newsboat/newsboat-basics-2003.nix | 35 | ||||
-rw-r--r-- | tests/modules/programs/newsboat/newsboat-basics-urls-2003.txt | 3 |
5 files changed, 50 insertions, 2 deletions
diff --git a/doc/release-notes/rl-2003.adoc b/doc/release-notes/rl-2003.adoc index fc1dcd7cfe2..5ca3cdd79e1 100644 --- a/doc/release-notes/rl-2003.adoc +++ b/doc/release-notes/rl-2003.adoc @@ -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. diff --git a/modules/programs/newsboat.nix b/modules/programs/newsboat.nix index 6b59ed713d8..793b30680bf 100644 --- a/modules/programs/newsboat.nix +++ b/modules/programs/newsboat.nix @@ -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} diff --git a/tests/modules/programs/newsboat/default.nix b/tests/modules/programs/newsboat/default.nix index 27f523a629c..f12f640ef29 100644 --- a/tests/modules/programs/newsboat/default.nix +++ b/tests/modules/programs/newsboat/default.nix @@ -1 +1,4 @@ -{ newsboat-basics = ./newsboat-basics.nix; } +{ + newsboat-basics = ./newsboat-basics.nix; + newsboat-basics-2003 = ./newsboat-basics-2003.nix; +} diff --git a/tests/modules/programs/newsboat/newsboat-basics-2003.nix b/tests/modules/programs/newsboat/newsboat-basics-2003.nix new file mode 100644 index 00000000000..587a31bb255 --- /dev/null +++ b/tests/modules/programs/newsboat/newsboat-basics-2003.nix @@ -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} + ''; + }; +} diff --git a/tests/modules/programs/newsboat/newsboat-basics-urls-2003.txt b/tests/modules/programs/newsboat/newsboat-basics-urls-2003.txt new file mode 100644 index 00000000000..68f81118053 --- /dev/null +++ b/tests/modules/programs/newsboat/newsboat-basics-urls-2003.txt @@ -0,0 +1,3 @@ +"query:foo:rssurl =~ \"example.com\"" +http://example.org/feed.xml "tag1" "tag2" "~Cool feed" +http://example.org/feed2.xml |