diff options
-rw-r--r-- | home/home.nix | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/home/home.nix b/home/home.nix index 3a5ff9c..3e854e6 100644 --- a/home/home.nix +++ b/home/home.nix @@ -131,6 +131,23 @@ functions.nix-what.body = '' nix-doc search $argv[1] ~/clones/nixpkgs ''; + functions.bahnsteig.body = '' + set station (echo $argv) + if string upper -q $station + set name (string escape --style=url $station) + set station (curl -sL https://ril100.bahnhof.name/$name) + echo ril100 $station + end + curl -s https://overpass-api.de/api/interpreter -d " + [out:json][timeout:25]; + node[~\"railway:ref|railway:ref:parent\"~\"^$station\$\"][operator~\"^(DB |Deutsch)\"]; + rel[public_transport~\"stop_area|stop_area_group\"](bn) -> .a; + rel[public_transport~\"stop_area|stop_area_group\"](br.a) -> .b; + (.a;.b;); + nwr[railway=platform](>>); + out; + " | jq '.elements[].tags.ref | select(. != null)' | sort + ''; }; programs.kitty = { |