ietf

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 992cbfe46511010351eb576dea44313e3c529c8a
Author: cy6erlion <dev@merely.tech>
Date:   Tue, 29 Dec 2020 16:46:42 +0200

initial commit

Diffstat:
A.gitignore | 2++
ACargo.lock | 456+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ACargo.toml | 18++++++++++++++++++
AREADME.md | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/fetch.rs | 101+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/lib.rs | 129+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/main.rs | 35+++++++++++++++++++++++++++++++++++
7 files changed, 791 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -0,0 +1,2 @@ +*~ +/target diff --git a/Cargo.lock b/Cargo.lock @@ -0,0 +1,456 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +dependencies = [ + "winapi", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi", +] + +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" +dependencies = [ + "byteorder", +] + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "bumpalo" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" + +[[package]] +name = "byteorder" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" + +[[package]] +name = "cc" +version = "1.0.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "2.33.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +dependencies = [ + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if 1.0.0", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99de365f605554ae33f115102a02057d4fc18b01f3284d6870be0938743cfe7d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "errno" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa68f2fb9cae9d37c9b2b3584aba698a2e97f72d7aef7b9f7aa71d8b54ce46fe" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14ca354e36190500e1e1fb267c647932382b54053c50b14970856c0b00a35067" +dependencies = [ + "gcc", + "libc", +] + +[[package]] +name = "gcc" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" + +[[package]] +name = "getrandom" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" +dependencies = [ + "cfg-if 0.1.10", + "libc", + "wasi", +] + +[[package]] +name = "hermit-abi" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aca5565f760fb5b220e499d72710ed156fdb74e631659e99377d9ebfbd13ae8" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" + +[[package]] +name = "log" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +dependencies = [ + "cfg-if 0.1.10", +] + +[[package]] +name = "minreq" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2466d0a7e6bfcd54f69e4a17d4a4318985aaaf7fe3df4cd3b6f11ff551129ca3" +dependencies = [ + "lazy_static", + "rustls", + "webpki", + "webpki-roots", +] + +[[package]] +name = "once_cell" +version = "1.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" + +[[package]] +name = "pager" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c7d08cf0d0b55c4f0ffedb5e06569ea212e85d622975071370393970491968" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "proc-macro2" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" + +[[package]] +name = "redox_users" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" +dependencies = [ + "getrandom", + "redox_syscall", +] + +[[package]] +name = "rfc" +version = "0.1.0" +dependencies = [ + "clap", + "dirs-next", + "minreq", + "pager", +] + +[[package]] +name = "ring" +version = "0.16.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "024a1e66fea74c66c66624ee5622a7ff0e4b73a13b4f5c326ddb50c708944226" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rustls" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" +dependencies = [ + "base64", + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "sct" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + +[[package]] +name = "syn" +version = "1.0.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + +[[package]] +name = "unicode-width" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3" + +[[package]] +name = "unicode-xid" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasm-bindgen" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" + +[[package]] +name = "web-sys" +version = "0.3.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91cd5736df7f12a964a5067a12c62fa38e1bd8080aff1f80bc29be7c80d19ab4" +dependencies = [ + "webpki", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "rfc" +version = "0.1.0" +authors = ["cy6erlion <dev@merely.tech>"] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +# For parsing command line arguments +clap = "2.33.3" +# Minimal HTTP client +minreq = {version = "2.2.1", features = ["https"]} +# Pager +pager = "0.16.0" +# Directories +dirs-next = "2.0.0" +\ No newline at end of file diff --git a/README.md b/README.md @@ -0,0 +1,50 @@ +``` text +█▀▄ █▀ ▄▀▀ +█▀▄ █▀ ▀▄▄ +``` +rfc 0.1.0 +A program to read RFCs in the terminal. + +USAGE: + + rfc [OPTIONS] [SUBCOMMAND] + + FLAGS: + -h, --help Prints help information + -V, --version Prints version information + + OPTIONS: + -n, --number <serial> RFC Serial Number + + SUBCOMMANDS: + help Prints this message or the help of the given subcommand(s) + update Update RFC Index + +## Features +* RFC index browser +* Read By RFC number +* Local Storage in (`~/rfc/` on unix systems and `C:\Users\{NAME}` on + windows) +* Pager + +## Guide + +### Running +To run simply type the following command in the shell to start the RFC +browser: + +``` bash +$ rfc +``` + +### Read RFC by number +``` bash +$ rfc -n 1 +``` + +### Update +To update the local RFC index, use the following command: + +``` bash +$ rfc update +``` diff --git a/src/fetch.rs b/src/fetch.rs @@ -0,0 +1,101 @@ +use std::fs::File; +use std::fs::OpenOptions; +use std::io::prelude::*; + +// Download RFC index file +pub fn index() -> Result<(), minreq::Error> { + println!("Fetching RFC index"); + let response = minreq::get("https://www.rfc-editor.org/rfc-index.txt").send()?; + let data = scrape(response.as_str()?); + persist_index(data); + Ok(()) +} + +// Download RFC localy +pub fn rfc(sn: u32) -> Result<(), minreq::Error> { + println!("Fetching RFC #{}", sn); + let address = format!("https://www.rfc-editor.org/rfc/rfc{}.txt", sn); + + println!("{}", address); + let response = minreq::get(&address).send()?; + persist_rfc(sn, response.as_str()?); + Ok(()) +} + +// Save index localy +pub fn persist_index(index: Vec<String>) { + if let Some(home_path) = dirs_next::home_dir() { + let path = if cfg!(unix) || cfg!(macos) { + format!("{}/rfc/INDEX", home_path.to_str().unwrap()) + } else if cfg!(windows) { + format!("{}\\rfc\\INDEX", home_path.to_str().unwrap()) + } else { + panic!("Unsupported OS"); + }; + + let file = File::create(&path).expect("Unable to create file"); + let mut file = OpenOptions::new() + .write(true) + .append(true) + .open(&path) + .unwrap(); + + for rfc in index.iter() { + if let Err(e) = writeln!(file, "{}", rfc) { + eprintln!("Couldn't write to file: {}", e); + } + } + } else { + panic!("Could not find home directory"); + } +} + +// Save RFC localy +pub fn persist_rfc(sn: u32, rfc: &str) { + if let Some(home_path) = dirs_next::home_dir() { + let path = if cfg!(unix) || cfg!(macos) { + format!("{}/rfc/{}", home_path.to_str().unwrap(), sn) + } else if cfg!(windows) { + format!("{}\\rfc\\{}", home_path.to_str().unwrap(), sn) + } else { + panic!("Unsupported OS"); + }; + + let file = File::create(&path).expect("Unable to create file"); + let mut file = OpenOptions::new() + .write(true) + .append(true) + .open(path) + .unwrap(); + + if let Err(e) = writeln!(file, "{}", rfc) { + eprintln!("Couldn't write to file: {}", e); + } + } else { + panic!("Could not find home directory"); + } +} + +// TODO: fix bug causing not to return the last RFC +pub fn scrape(data: &str) -> Vec<String> { + let mut count = 0; + let mut rfcs = vec![]; + let mut buff = String::from(""); + + for line in data.lines() { + // Skip first 65 lines + if count > 65 { + // Detect blank lines + if line == "" { + rfcs.push(buff); + buff = String::from(""); + } else { + buff = format!("{}{}", buff, line); + } + } else { + count = count + 1; + } + } + + rfcs +} diff --git a/src/lib.rs b/src/lib.rs @@ -0,0 +1,129 @@ +extern crate dirs_next; +extern crate pager; + +use pager::Pager; +use std::fs::File; +use std::io::{BufReader, Read}; +use std::path::Path; + +mod fetch; + +pub fn list_view() { + if !index_exists().unwrap() { + // Download all RFCs + fetch::index().unwrap(); + } + + let path = if let Some(home_path) = dirs_next::home_dir() { + if cfg!(unix) || cfg!(macos) { + format!("{}/rfc/INDEX", home_path.to_str().unwrap()) + } else if cfg!(windows) { + format!("{}\\rfc\\INDEX", home_path.to_str().unwrap()) + } else { + panic!("Unsupported OS"); + } + } else { + panic!("No home directory"); + }; + + let mut index = String::new(); + let f = File::open(&path).expect("Unable to open file"); + let mut br = BufReader::new(f); + let mut dots = ""; + + br.read_to_string(&mut index).expect("Unable to read INDEX"); + + Pager::with_pager("less -r").setup(); + + for line in index.lines() { + let line_words: Vec<&str> = line.split(' ').collect(); + let summerize: String = line.chars().skip(line_words[0].len()).take(77).collect(); + + if line.len() >= 77 { + dots = "..."; + } + + println!("{} | {}{}", line_words[0], summerize, dots); + + dots = ""; + } +} + +// Read RFC by serial number +pub fn read_rfc(sn: u32) { + // check if RFC is downloaded + if !is_rfc_downloaded(sn).unwrap() { + // download RFC + println!("Downloading rfc"); + fetch::rfc(sn).unwrap(); + } + + let path = if let Some(home_path) = dirs_next::home_dir() { + if cfg!(unix) || cfg!(macos) { + format!("{}/rfc/{}", home_path.to_str().unwrap(), sn) + } else if cfg!(windows) { + format!("{}\\rfc\\{}", home_path.to_str().unwrap(), sn) + } else { + panic!("Unsupported OS"); + } + } else { + panic!("No home directory"); + }; + + let mut rfc = String::new(); + let f = File::open(&path).expect("Unable to open file"); + let mut br = BufReader::new(f); + br.read_to_string(&mut rfc).expect("Unable to read RFC"); + + // Read RFC + Pager::with_pager("less -r").setup(); + println!("{}", &rfc); +} + +// Update RFC +pub fn update() { + fetch::index().unwrap(); +} + +// Check if it is first time running by +// checking if config files exist +fn index_exists() -> Result<bool, ()> { + if let Some(home_path) = dirs_next::home_dir() { + let path = if cfg!(unix) || cfg!(macos) { + format!("{}/rfc/INDEX", home_path.to_str().unwrap()) + } else if cfg!(windows) { + format!("{}\\rfc\\INDEX", home_path.to_str().unwrap()) + } else { + panic!("Unsupported OS"); + }; + + if Path::new(&path).exists() { + return Ok(true); + } else { + return Ok(false); + } + } else { + panic!("Could not find home directory"); + } +} + +// Check if an RFC has been downloaded locally +fn is_rfc_downloaded(sn: u32) -> Result<bool, ()> { + if let Some(home_path) = dirs_next::home_dir() { + let path = if cfg!(unix) || cfg!(macos) { + format!("{}/rfc/{}", home_path.to_str().unwrap(), sn) + } else if cfg!(windows) { + format!("{}\\rfc\\{}", home_path.to_str().unwrap(), sn) + } else { + panic!("Unsupported OS"); + }; + + if Path::new(&path).exists() { + return Ok(true); + } else { + return Ok(false); + } + } else { + panic!("Could not find home directory"); + } +} diff --git a/src/main.rs b/src/main.rs @@ -0,0 +1,35 @@ +use clap::{App, Arg, SubCommand}; + +fn main() { + let matches = App::new("rfc") + .version("0.1.0") + .about("A program to read RFCs in the terminal.") + .arg( + Arg::with_name("Number") + .short("n") + .long("number") + .value_name("serial") + .help("RFC Serial Number") + .takes_value(true), + ) + .subcommand(SubCommand::with_name("update").about("Update RFC Index")) + .get_matches(); + + // Read RFC by serial number + if let Some(n) = matches.value_of("Number") { + rfc::read_rfc( + n.parse::<u32>() + .expect("RFC Serial Number should be a numeric value!"), + ); + return; + } + + // Update RFC index + if let Some(matches) = matches.subcommand_matches("update") { + rfc::update(); + return; + } + + // Display RFC list view + rfc::list_view(); +}