Code Monkey home page Code Monkey logo

rfc's Introduction

rfc

rfc is a simple tool written in Bash to read RFCs from the command-line. It fetches RFCs and drafts from the Web and caches them locally.

Usage

Just type rfc followed by the RFC number or the draft name:

$ rfc <RFC number>

e.g.:

rfc 42 # Read the RFC 42
rfc 1234 # Read the RFC 1234
rfc draft-ietf-core-coap-18 # Read IETF draft core-coap version 18

Use rfc help to see all available subcommands.

Options

  • --version: same as the version subcommand
  • --help: same as the help subcommand

Exit codes

  • 0: normal execution
  • 1: the requested RFC or archive cannot be found
  • 2: unrecognized option/subcommand
  • 3: unable to connect to the network
  • 4: can't find curl nor wget

Install

Basic install

mkdir -p ~/bin
curl -sL https://raw.githubusercontent.com/bfontaine/rfc/v1.0.0/rfc > ~/bin/rfc
chmod u+x ~/bin/rfc

This creates the ~/bin directory if it doesn’t exist, and download rfc in it. If it’s not in your PATH, you have to add it:

echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc

You may also want to install the manpage, located in man/rfc.1.

Using Homebrew

If you use Homebrew or Linuxbrew you can install rfc with one command:

brew install bfontaine/utils/rfc

Archlinux

For archlinux users, you can use the AUR package rfc-read.

The command for use it is rfc.

openSUSE

The openSUSE package is called rfc-read and can be installed via zypper in rfc-read.

Requirements

  • curl or wget. It uses $CURL if it’s set, and fallback on curl and then wget.
  • less or another pager. It uses $PAGER if it’s set.

Customization

You can choose which directory rfc uses by setting the RFC_DIR environment variable. The directory is automatically created if it doesn’t exist.

The default directory is $XDG_CACHE_HOME/RFCs if XDG_CACHE_HOME is set, otherwise ~/.cache/RFCs.

Troubleshooting

rfc version 0.2.5 and above has a special --debug flag that, if passed as the first argument, enables tracing of all the Bash commands in the script.

Credits

Baptiste Fontaine and contributors.

rfc's People

Contributors

bfontaine avatar clehner avatar delucks avatar jubalh avatar kaorimatz avatar leonklingele avatar neodarz avatar reitermarkus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rfc's Issues

New release for include man page

Hi,

I want to make an Archlinux package but the man page is not in the latest release.

Can you make a new release who include this man page please?

Thanks for your work!

sync {week,month} is broken

$ rfc sync week
/home/baptiste/.linuxbrew/bin/rfc: ligne 43: /home/baptiste/.RFCs/_tmp/<li><a href="7daysTo2018Jun22.tar.gz"> 7daysTo2018Jun22.tar.gz</a></li>: Aucun fichier ou dossier de ce type
tar (child): <li><a : open impossible: Aucun fichier ou dossier de ce type
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
ls: impossible d'accéder à 'rfc*.txt': Aucun fichier ou dossier de ce type

$ rfc sync month
/home/baptiste/.linuxbrew/bin/rfc: ligne 43: /home/baptiste/.RFCs/_tmp/<li><a href="30daysTo2018Jun22.tar.gz"> 30daysTo2018Jun22.tar.gz</a></li>: Aucun fichier ou dossier de ce type
tar (child): <li><a : open impossible: Aucun fichier ou dossier de ce type
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
ls: impossible d'accéder à 'rfc*.txt': Aucun fichier ou dossier de ce type

$ rfc sync all
# (ok)

Minor documentation nits

A couple of things look funny to me:

  1. If you understand the same convention around square brackets that I do, then the synopsis indicates to me that an argument is optional, when in fact one is required. Ideally just this?:

    rfc <command> | <number>

  2. If angle brackets above indicate user-provided argument then for consistency I would expect the same for sub-commands:

    rfc search <query>

  3. Along the same lines, if you don't bold the sync synopsis keywords, why do you underline the search synopsis keyword? Or vice-versa ...

  4. The CURL environment variable description is not quite a sentence. Perhaps "Force the use of curl (default) or wget to retrieve RFC files"?

Add support for drafts

From HN reader smoyer. E.g.:

# downloads from https://tools.ietf.org/id/draft-ietf-scim-api-01.txt
rfc draft-ietf-scim-api-01

# or maybe (the 'draft' option makes it download the RFC from tools.ietf.org instead):
rfc --draft ietf-scim-api-01

Drafts URLs are all like https://tools.ietf.org/id/draft-SOMETHING.txt.

rfc editor moved to https

Issue description

executing rfc 8252 does not show the rfc content.

Steps to reproduce the issue

  1. install rfc-get
  2. execute rfc 8252

What's the expected result?

  • the rfc content should be displayed

What's the actual result?

  • a message is showing, that the content was moved

Additional details / screenshot

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>301 Moved Permanently</title>
</head><body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://www.rfc-editor.org/rfc/rfc8252.txt">here</a>.</p>
</body></html>

Consider placing RFC cache directory under XDG_CACHE_HOME?

I've been trying to clean up my $HOME directory a little, where of course rfc adds it's cache directory. I was wondering if you would consider following the XDG_CACHE_HOME convention? That would possibly mean:

  • Using $XDG_CACHE_HOME for the parent directory if defined; or else
  • Using $HOME/.cache (and/or $HOME/Library/Caches?) for the parent directory
  • Warning or automatically moving the RFCs cache from $HOME to the location

Add a “Download them all” subcommand

Proposed by Reddit user neoice. In addition, we could sync the RFCs that have changed since the last download/sync.

There are two possibilities:

  • Using rsync: Easy to synchronize, but we would have to change the filenames of the RFCs (actually, we're using $rfc_dir/N, where N is the RFC number) to match the one used by rfc-editor.org (rfcN.txt).
  • Download the weekly .tar.gz provided by rfc-editor.org: Harder to synchronize with (even if rfc-editor.org provide a weekly .tar.gz which contains all RFCs which changed during the past 7 and 30 days), since we would have to remember the last time we synchronized.

Update:

regarding the second possibility:

  • rfc sync all: download all RFCs
  • rfc sync month: 30 days
  • rfc sync week: 7 days

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.