Search and read 'The Rust Book' from the terminal

Overview

TheBook

Discord License: MIT Crates.io Crates.io GitHub top language

TheBook is a command line utility that allows you to SEARCH and READ The Rust Programming Language (popularly known as 'The Book' ) from the terminal. Ever wanted to quickly look up how to spawn threads, or how to declare Structs in Rust? TheBook allows you to do so by simply typing thebook spawn threads or thebook structs. TheBook renders markdown in the terminal and provides a browser-like experience. It is geared towards Rust beginners who are not quite familiar with the Rust syntax, and Rust experts who want the luxury of typing a few commands in the terminal to look up a certain Rust concept.

If you still prefer the graphical experience of a real web browser, you can use TheBook as a simple 'The Book' launcher. Just run thebook in the terminal without any arguments, and 'The Book' will automatically open in your web browser.

TheBook borrows the IMPOSTER_DETECTION_ALGORITHM from AmongRust for advanced search processing and intelligent query parsing hehe! ඞ :).

Note: This crate is still new, the results may not be perfect, and the code is a little messy, but hey! it gets the job done :) Please give this project a star on Github and subscribe to my new YouTube channel for fun programming videos.

USAGE

cargo install thebook

That's it. you're done. Now run thebook what you want to search to search for something or just thebook to open 'The Book' in your web browser.

screenshot

COMMAND ARGUMENTS

Command Description Example
thebook <search query> Searches for <search query> and renders markdown in the terminal thebook using structs
thebook Opens the book in the default browser thebook
thebook --reset Re-downloads a fresh copy of the book thebook --reset

Made with ❤️ by Hiro

Comments
  • Consider changing the keys to commonly used alternatives

    Consider changing the keys to commonly used alternatives

    Thanks for this awesome app!

    I think it would be better to use Vim keys l and h as well as the arrows for moving backwards and forwards? a and d have no meaning I know of, are they from another commonly used app?

    If it were up to me it would be q for quit, but that is only because it is the default in mpv... but I am still not sure why c would be better?

    enhancement TODO 
    opened by David-Else 10
  • cannot clone the book's repository

    cannot clone the book's repository

    I just downloaded this CLI tool and tried to run it with this command

    thebook
    

    I'm getting this error output

    book does not exist
    Cloning the book from: https://github.com/rust-lang/book
    thread 'main' panicked at 'failed to clone: authentication required but no callback set; class=Ssh (23); code=Auth (-16)', /home/mouhsenibrahim/.cargo/registry/src/github.com-1ecc6299db9ec823/thebook-0.1.1/src/main.rs:72:19
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    

    It looks like a bug in git2 dependency or am I doing something wrong?

    Thanks a lot for writing this I just started learning rust 2 weeks ago and really enjoying it

    bug 
    opened by mohsenSy 5
  • The install location of the book is not suitable for opening by all browsers

    The install location of the book is not suitable for opening by all browsers

    Some browsers block access to filesystem urls where a path component starts with dot (.)

    This emerged during my testing described here. Because the book is installed under ~/.thebook, Firefox & Chrome (on Ubuntu 22.04 at least) do not open the book (see screenshot).

    The moment I changed the location to ~/thebook instead of ~/.thebook, it worked.

    image

    bug 
    opened by amodm 4
  • openssl (libssl-dev) dependancy.

    openssl (libssl-dev) dependancy.

    Hi, Just a note to say that when installing, i got the following error: error: failed to run custom build command for openssl-sys v0.9.78 Caused by: process didn't exit successfully: /tmp/cargo-installJrrJtj/release/build/openssl-sys-689f17fcd246adcc/build-script-main (exit status: 101)

    It does helpfully tell you that you need to install libssl-dev for the openssl-sys crate to compile. You might want to let people know that this is a dependency when installing.

    Everything else looks perfect! Thanks for creating it!

    FYI Running Debian11 stable.

    opened by sfarq 4
  • Feature request

    Feature request

    Hello, Enjoying the tool (i am a rust novice so finding quite useful - thanks again). I have a couple of suggestions, not sure if you have these on your list of things to do anyway...

    • o for opening the actual Book, this should take you to the page you opened it from, rather than the beginning of the book.
    • Refreshing the downloaded book. There should be a command line argument for re-downloading TheBook, or automatically refreshing it opening. Maybe some sort of monthly prompt to ask the user if they want to refresh it?
    • Find/Highlight words. It would be good to be able to do a basic search for words within an open page. i.e VIM keyboard short cut '/' and type words to search on the page. ('n' for next and 'N' for previous - again VIM standard)
    • Page linking. Appreciate this is probably a bit more effort, but it would be really cool to navigate around the book, (inside the results), using the book links provided...

    Also - how do you feel about pull requests? would you be open to include them if we submitted fixes / features?

    enhancement TODO 
    opened by sfarq 6
  • `class=

    `class="caption"` text not being rendered properly

    Rather than rendering in any style, captions are being displayed as HTML as follows:

    <span class="caption">Listing 10-25: A function we defined in Listing 4-9 that            ▐
    compiled without lifetime annotations, even though the parameter and return               ▐
    type are references</span>
    

    For example on the Lifetime Elision page.

    enhancement TODO 
    opened by David-Else 4
  • Visual Studio Code Support

    Visual Studio Code Support

    Hello, I saw earlier that you wanted to add it to your to-do list, but I do not know where that is, so I figured I'd add it as an issue, at least.

    I only bring this up, because currently when I run thebook it looks like it's trying to open in Visual Studio Code on my computer by default, which is admittedly something I probably did to my environment to make that happen.

    Is there a workaround I can use so that it does not open it using my default settings until you add support? Thank you.

    Environment details:

    Distributor ID:	Ubuntu
    Description:	Ubuntu 22.04.1 LTS
    Release:	22.04
    Codename:	jammy
    
    bug enhancement TODO 
    opened by Nbjohnston86 7
Releases(v0.2.2)
Owner
0xHiro 技術者
[Rust, C, Go]; Check out my blog at www.hiro.codes
0xHiro 技術者
High Assurance Rust - A free book about developing secure and robust systems software.

High Assurance Rust - A free book about developing secure and robust systems software.

Tiemoko Ballo 1.1k Jan 9, 2023
Majestic Lisp book and implementation, in Brazillian Portuguese.

Majestic Lisp Criado e desenvolvido por Lucas S. Vieira <lucasvieira at protonmail dot com>. Seja bem-vindo(a) a Majestic Lisp, um dialeto de Lisp cuj

Lucas Vieira 3 Oct 26, 2022
A library for extracting #[no_mangle] pub extern "C" functions (https://docs.rust-embedded.org/book/interoperability/rust-with-c.html#no_mangle)

A library for extracting #[no_mangle] pub extern "C" functions In order to expose a function with C binary interface for interoperability with other p

Dmitrii - Demenev 0 Feb 17, 2022
clone of grep cli written in Rust. From Chapter 12 of the Rust Programming Language book

minigrep is a clone of the grep cli in rust Minigrep will find a query string in a file. To test it out, clone the project and run cargo run body poem

Raunak Singh 1 Dec 14, 2021
The ray tracer challenge in rust - Repository to follow my development of "The Raytracer Challenge" book by Jamis Buck in the language Rust

The Ray Tracer Challenge This repository contains all the code written, while step by implementing Ray Tracer, based on the book "The Ray Tracer Chall

Jakob Westhoff 54 Dec 25, 2022
A minimal version of 'grep' implemented in Rust. Exercise in the "The Rust Programming Language" book.

Minigrep - A simple grep-like tool implemented in Rust This simple CLI tool searches for a given pattern in a specified file and as a result, it print

Filip Szutkowski 3 Mar 15, 2024
This repository contains the source of "The Rust Programming Language" book.

The Rust Programming Language This repository contains the source of "The Rust Programming Language" book. The book is available in dead-tree form fro

The Rust Programming Language 11.2k Jan 8, 2023
Source code for the book Rust in Action

Welcome to Rust in Action source code This source code repository is a companion to the Rust in Action book available from Manning Publications. Suppo

Rust in Action 1.3k Dec 30, 2022
Code to follow along the "Zero To Production" book on API development in Rust.

Zero To Production / Code (Chapter 10 - Part 1) Zero To Production In Rust is an opinionated introduction to backend development using Rust. This repo

Luca Palmieri 2.8k Dec 31, 2022
Rust crate to implement a counterpart to the PBRT book's (3rd edition) C++ code.

Rust crate to implement a counterpart to the PBRT book's (3rd edition) C++ code.

Jan Walter 763 Dec 27, 2022
Learn programming with Rust as a first language (book)

Learn programming with Rust as first language This is a book to learn programming from scratch. Read the book here: https://deavid.github.io/lprfl/ LI

David Martínez Martí 2 May 21, 2022
Book - Actix user guides

User guides Actix User Guide Actix API Documentation (Development) Actix API Documentation (Releases) Actix Web User Guide Actix Web API Documentation

Actix 185 Dec 25, 2022
Complete code for the larger example programs from the book.

Code Examples for Programming Rust This repository contains complete code for the larger example programs from the book “Programming Rust”, by Jim Bla

Programming Rust 670 Jan 1, 2023
Generate SUMMARY.md files based on your book's file structure

mdbook-autosummary Generate a SUMMARY.md for your mdBook based on your folder structure! Warning The implementation is hacky and has several limitatio

Hyper 3 Sep 30, 2023
Too lazy to read the full article? Skim it

SkimGPT When you're too lazy to either read the article or ask AI questions, you can use SkimGPT to help you. Install Clone this repo: git clone https

Huy 9 Apr 22, 2023
Rust wrappers for NGT approximate nearest neighbor search

ngt-rs   Rust wrappers for NGT, which provides high-speed approximate nearest neighbor searches against a large volume of data. Note that NGT will be

Romain Leroux 16 Sep 19, 2022
memchr vs stringzilla - up to 7x throughput difference between two SIMD-accelerated substring search libraries in Rust

memchr vs stringzilla Rust Substring Search Benchmarks Substring search is one of the most common operations in text processing, and one of the slowes

Ash Vardanian 38 Mar 5, 2024
Static low-bandwidth search at scale

Pagefind Pagefind is a fully static search library that aims to perform well on large sites, while using as little of your users' bandwidth as possibl

CloudCannon 657 Dec 30, 2022
A cli tool to write your idea in terminal

Ideas ideas is a cli tools to write your idea in your terminal. Demo Features tagged idea, contains tips, idea, todo status switch ascii icon write yo

王祎 12 Jun 22, 2022