diff --git a/CHANGELOG.md b/CHANGELOG.md index 4842453..7c58635 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ Changelog UNRELEASED - 2020-04-20 ----------------------- -- :sparkles: [`xxxxxxxxxxxx`](https://github.com/casey/intermodal/commits/master) Add `--terminal` override terminal autodetection - Fixes [#398](https://github.com/casey/intermodal/issues/398) - _Casey Rodarmor _ +- :books: [`xxxxxxxxxxxx`](https://github.com/casey/intermodal/commits/master) Create FAQ - Fixes [#397](https://github.com/casey/intermodal/issues/397) - _Casey Rodarmor _ +- :sparkles: [`65597c98510b`](https://github.com/casey/intermodal/commit/65597c98510b0536247c58a4cead559d3b3817be) Add `--terminal` override terminal autodetection - Fixes [#398](https://github.com/casey/intermodal/issues/398) - _Casey Rodarmor _ - :books: [`70dbe93c6ab0`](https://github.com/casey/intermodal/commit/70dbe93c6ab01408dfc42e1b75664de13de16a51) Note install script only works on Linux and MacOS - Fixes [#371](https://github.com/casey/intermodal/issues/371) - _Casey Rodarmor _ - :books: [`b67a2f1885c9`](https://github.com/casey/intermodal/commit/b67a2f1885c9445c08411457809f8893ebfa2045) Fix 404.css link - _Casey Rodarmor _ - :books: [`87687f4decbb`](https://github.com/casey/intermodal/commit/87687f4decbbd216b32ea3c9001122c56d5a93fc) Add custom 404 page to site - _Casey Rodarmor _ diff --git a/bin/gen/config.yaml b/bin/gen/config.yaml index 176c8ee..ac254f7 100644 --- a/bin/gen/config.yaml +++ b/bin/gen/config.yaml @@ -121,3 +121,17 @@ references: - url: https://github.com/j01tz/grin-rfcs/blob/slate-serialization/text/0000-slate-serialization.md description: 'Grin Slate Serialization' + +faq: +- title: Can intermodal be used to preview torrents with `fzf`? + anchor: fzf-preview + text: |- + Yes! [@mustaqimM](https://github.com/mustaqimM) came up with the following: + + fzf --preview='imdl --color always --terminal torrent show --input {} + + _Note the use of `--color always` and `--terminal` to force colored, human readable output._ + + This can be used to, for example, preview the torrents in a directory: + + find . -name '*.torrent' | fzf --preview='imdl -c always -t torrent show -i {}' diff --git a/bin/gen/src/common.rs b/bin/gen/src/common.rs index 1c82aad..5003c50 100644 --- a/bin/gen/src/common.rs +++ b/bin/gen/src/common.rs @@ -31,8 +31,9 @@ pub(crate) use crate::{ // structs and enums pub(crate) use crate::{ - bin::Bin, changelog::Changelog, config::Config, entry::Entry, example::Example, - introduction::Introduction, kind::Kind, metadata::Metadata, opt::Opt, package::Package, - project::Project, readme::Readme, reference::Reference, reference_section::ReferenceSection, - release::Release, subcommand::Subcommand, summary::Summary, table::Table, + bin::Bin, changelog::Changelog, config::Config, entry::Entry, example::Example, faq::Faq, + faq_entry::FaqEntry, introduction::Introduction, kind::Kind, metadata::Metadata, opt::Opt, + package::Package, project::Project, readme::Readme, reference::Reference, + reference_section::ReferenceSection, release::Release, subcommand::Subcommand, summary::Summary, + table::Table, }; diff --git a/bin/gen/src/config.rs b/bin/gen/src/config.rs index f7796c6..734155c 100644 --- a/bin/gen/src/config.rs +++ b/bin/gen/src/config.rs @@ -8,6 +8,7 @@ pub(crate) struct Config { pub(crate) examples: Vec, pub(crate) packages: Vec, pub(crate) references: Vec, + pub(crate) faq: Vec, } impl Config { diff --git a/bin/gen/src/faq.rs b/bin/gen/src/faq.rs new file mode 100644 index 0000000..a826b6b --- /dev/null +++ b/bin/gen/src/faq.rs @@ -0,0 +1,15 @@ +use crate::common::*; + +#[derive(Template)] +#[template(path = "faq.md")] +pub(crate) struct Faq { + pub(crate) entries: Vec, +} + +impl Faq { + pub(crate) fn new(entries: &[FaqEntry]) -> Self { + Self { + entries: entries.to_vec(), + } + } +} diff --git a/bin/gen/src/faq_entry.rs b/bin/gen/src/faq_entry.rs new file mode 100644 index 0000000..64482f1 --- /dev/null +++ b/bin/gen/src/faq_entry.rs @@ -0,0 +1,8 @@ +use crate::common::*; + +#[derive(Clone, Debug, Deserialize)] +pub(crate) struct FaqEntry { + pub(crate) title: String, + pub(crate) text: String, + pub(crate) anchor: String, +} diff --git a/bin/gen/src/main.rs b/bin/gen/src/main.rs index 0fedaee..c84d4e5 100644 --- a/bin/gen/src/main.rs +++ b/bin/gen/src/main.rs @@ -11,6 +11,8 @@ mod config; mod entry; mod example; mod exit_status_ext; +mod faq; +mod faq_entry; mod introduction; mod kind; mod metadata; diff --git a/bin/gen/src/opt.rs b/bin/gen/src/opt.rs index 9eca26c..9693d1e 100644 --- a/bin/gen/src/opt.rs +++ b/bin/gen/src/opt.rs @@ -151,6 +151,10 @@ impl Opt { fs::write(path, text)?; } + let faq = Faq::new(&project.config.faq); + + fs::write(project.root.join("book/src/faq.md"), faq.render_newline()?)?; + let summary = Summary::new(project); let text = summary.render_newline()?; diff --git a/bin/gen/templates/SUMMARY.md b/bin/gen/templates/SUMMARY.md index 3f8e667..eb9348a 100644 --- a/bin/gen/templates/SUMMARY.md +++ b/bin/gen/templates/SUMMARY.md @@ -3,6 +3,8 @@ Summary [Intermodal](./introduction.md) +- [FAQ](./faq.md) + {{commands}} - [Bittorrent](./bittorrent.md) diff --git a/bin/gen/templates/faq.md b/bin/gen/templates/faq.md new file mode 100644 index 0000000..f5d27c6 --- /dev/null +++ b/bin/gen/templates/faq.md @@ -0,0 +1,14 @@ +FAQ +=== + +{% for entry in entries %} +- [{{entry.title}}](#{{entry.anchor}}) +{% endfor %} + +{% for entry in entries %} +

+{{entry.title}} +

+ +{{entry.text}} +{% endfor %} diff --git a/book/src/SUMMARY.md b/book/src/SUMMARY.md index 36bc507..64945ab 100644 --- a/book/src/SUMMARY.md +++ b/book/src/SUMMARY.md @@ -3,6 +3,8 @@ Summary [Intermodal](./introduction.md) +- [FAQ](./faq.md) + - [Commands](./commands.md) - [`imdl`](./commands/imdl.md) - [`imdl completions`](./commands/imdl-completions.md) diff --git a/book/src/faq.md b/book/src/faq.md new file mode 100644 index 0000000..ddbae27 --- /dev/null +++ b/book/src/faq.md @@ -0,0 +1,21 @@ +FAQ +=== + + +- [Can intermodal be used to preview torrents with `fzf`?](#fzf-preview) + + + +

+Can intermodal be used to preview torrents with `fzf`? +

+ +Yes! [@mustaqimM](https://github.com/mustaqimM) came up with the following: + + fzf --preview='imdl --color always --terminal torrent show --input {} + +_Note the use of `--color always` and `--terminal` to force colored, human readable output._ + +This can be used to, for example, preview the torrents in a directory: + + find . -name '*.torrent' | fzf --preview='imdl -c always -t torrent show -i {}'