citadel

My dotfiles, scripts and nix configs
git clone git://jb55.com/citadel
Log | Files | Refs | README | LICENSE

commit 708cab03c76b058710bcda30f08c226edba7c7c0
parent 913b3969942eaafd81574c59e4d58751efeaa010
Author: William Casarin <jb55@jb55.com>
Date:   Sat, 19 Sep 2020 12:09:04 -0700

bin: add rfc commands

Diffstat:
Abin/rfc | 22++++++++++++++++++++++
Abin/rfcs | 2++
2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/bin/rfc b/bin/rfc @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +if [ -z $1 ] +then + printf "usage: rfc <rfc#>\n" + exit 1 +fi + +RFC_DIR="$HOME/docs/rfc" + +mkdir -p $RFC_DIR +cd "$RFC_DIR" + +rfc_file="$RFC_DIR/rfc${1}.txt" + +if [ ! -f "$rfc_file" ] +then + url="https://tools.ietf.org/rfc/rfc${1}.txt" + curl --fail --compressed -s "$url" > "$rfc_file" || (rm -f "$rfc_file" && exit 1) +fi + +exec lessr "$rfc_file" diff --git a/bin/rfcs b/bin/rfcs @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +exec books $HOME/docs/rfc