home/fish: add getmnter function

This commit is contained in:
Guanran Wang 2024-06-12 21:27:05 +08:00
parent 2141256716
commit 1403595ae1
Signed by: nyancat
GPG key ID: 91F97D9ED12639CF

View file

@ -58,14 +58,22 @@
"farsee" = "curl -F 'c=@-' 'https://fars.ee/'"; # pb "farsee" = "curl -F 'c=@-' 'https://fars.ee/'"; # pb
}; };
programs.fish.functions = { programs.fish.functions = let
"pb" = let jq = lib.getExe pkgs.jq;
jq = lib.getExe pkgs.jq; nix = lib.getExe pkgs.nix;
curl = lib.getExe pkgs.curl; curl = lib.getExe pkgs.curl;
in '' awk = lib.getExe pkgs.gawk;
in {
"pb" = ''
${jq} -Rns '{text: inputs}' | \ ${jq} -Rns '{text: inputs}' | \
${curl} -s -H 'Content-Type: application/json' --data-binary @- https://pb.ny4.dev | \ ${curl} -s -H 'Content-Type: application/json' --data-binary @- https://pb.ny4.dev | \
${jq} -r '. | "https://pb.ny4.dev\(.path)"' ${jq} -r '. | "https://pb.ny4.dev\(.path)"'
''; '';
"getmnter" = ''
${nix} eval nixpkgs#{$argv}.meta.maintainers --json | \
${jq} '.[].github' -r | \
${awk} '{ print "@" $1 }'
'';
}; };
} }