mirror of
https://github.com/kmein/niveum
synced 2026-03-18 11:01:07 +01:00
feat(scripts): pimp rfc script
This commit is contained in:
@@ -1 +0,0 @@
|
|||||||
curl -sSL "https://tools.ietf.org/rfc/rfc$*.txt" | less
|
|
||||||
@@ -144,6 +144,7 @@ in {
|
|||||||
scripts.liddel-scott-jones
|
scripts.liddel-scott-jones
|
||||||
# kmein.slide
|
# kmein.slide
|
||||||
scripts.tolino-screensaver
|
scripts.tolino-screensaver
|
||||||
|
scripts.rfc
|
||||||
nix-prefetch-git
|
nix-prefetch-git
|
||||||
scripts.nix-git
|
scripts.nix-git
|
||||||
nixfmt
|
nixfmt
|
||||||
|
|||||||
@@ -302,6 +302,11 @@ in rec {
|
|||||||
|
|
||||||
unicodmenu = pkgs.callPackage ./unicodmenu.nix { };
|
unicodmenu = pkgs.callPackage ./unicodmenu.nix { };
|
||||||
|
|
||||||
|
rfc = wrapScript {
|
||||||
|
script = ./rfc.sh;
|
||||||
|
name = "rfc";
|
||||||
|
packages = [ pkgs.curl pkgs.pup pkgs.gnused pkgs.gawk pkgs.gnugrep pkgs.fzf ];
|
||||||
|
};
|
||||||
|
|
||||||
bvg = pkgs.callPackage ./bvg.nix { };
|
bvg = pkgs.callPackage ./bvg.nix { };
|
||||||
nav = pkgs.callPackage ./nav.nix { };
|
nav = pkgs.callPackage ./nav.nix { };
|
||||||
|
|||||||
24
packages/scripts/rfc.sh
Normal file
24
packages/scripts/rfc.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -efu
|
||||||
|
|
||||||
|
cache_file=/tmp/rfc-index.txt
|
||||||
|
|
||||||
|
fetch_index() {
|
||||||
|
if [ -f "$cache_file" ]
|
||||||
|
then cat "$cache_file"
|
||||||
|
else curl -sSL https://tools.ietf.org/rfc/index | tee "$cache_file"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
rfc_list="$(fetch_index \
|
||||||
|
| pup 'pre text{}' \
|
||||||
|
| awk '$0 != "" {printf "%s",$0} $0 == "" {printf "\n"}' \
|
||||||
|
| sed 's/\s\+/ /g' \
|
||||||
|
| sed 'n;d' \
|
||||||
|
| grep '^RFC[[:digit:]]' \
|
||||||
|
| sed 's/RFC\([[:digit:]]\+\)/\1\t/;s/\. .*//'
|
||||||
|
)"
|
||||||
|
|
||||||
|
selection="$(echo "$rfc_list" | fzf | awk '{print $1}')"
|
||||||
|
|
||||||
|
curl -sSL "https://tools.ietf.org/rfc/rfc$selection.txt" | less
|
||||||
Reference in New Issue
Block a user