Crates.io | archwiki-rs |
lib.rs | archwiki-rs |
version | 3.2.5 |
source | src |
created_at | 2023-05-28 19:12:15.172706 |
updated_at | 2024-04-30 10:46:35.2029 |
description | A CLI tool to read pages from the ArchWiki |
homepage | https://gitlab.com/lucifayr/archwiki-rs |
repository | https://gitlab.com/jackboxx/archwiki-rs |
max_upload_size | |
id | 876672 |
size | 211,787 |
Currently, you can only install this tool from crates.io or build it from source.
After installation, you might want to run the sync-wiki
command.
cargo install archwiki-rs
git clone https://gitlab.com/lucifayr/archwiki-rs
cd archwiki-rs
cargo install --path .
archwiki-rs read-page Neovim
archwiki-rs read-page Neovim --format markdown
By default, pages are cached in the file system after they are fetched and subsequent request for that page then use that cache. The cache is invalidated if the cached file hasn't been modified in the last 14 days.
If the page you are searching for doesn't exist, a list of the pages that are most similar (in name) to the page you asked for will be output instead of the page content
archwiki-rs read-page Neovi
# output
Neovim
...
Unlike the output when the page name does exist, this output is written to stderr instead of stdout. If you want to, you can create a program that checks if no page was found and uses stderr to give the user suggestions on what they might have wanted to type.
An example shell script to do something like this is available in the repository
under the name example.sh
which can be used like this sh example.sh <page-name>
.
archwiki-rs search "Emacs"
This returns a table of pages with a similar title and their URLs
archwiki-rs search "shell" -t
This returns a table of pages which contain the search term and the snippet of text that the search term is in
Page and category names are stored locally for faster look-ups. Use this command to fetch all page and category names.
archwiki-rs sync-wiki
archwiki-rs list-pages
This outputs a styled tree of categories and pages but if you need an easily parsable
list for a different program to use, you can use the -f
flag to flatten the output into a
newline separated list that only contains the names of all pages
archwiki-rs list-pages -f
You can also limit the list to only include pages that belong to a specific category
archwiki-rs list-pages -c "Xorg commands"
To do the same for categories you can run
archwiki-rs list-categories
And the same for available languages
archwiki-rs list-languages
Use this command to download a local copy of the ArchWiki. Be warned, this command makes over 10,000 requests to the ArchWiki so it takes a while to finish (-, -)…zzzZZ
archwiki-rs local-wiki ~/local-archwiki --format markdown
If you don't mind your CPU and network becoming a bit saturated you can increase the amount of threads used to fetch data from the wiki.
Keep in mind that you might get rate limited by the ArchWiki if you make too many requests at once.
archwiki-rs local-wiki -t 8
Other information such as the value/location of the cache directory
can be obtained
using the info
command
archwiki-rs info
To only get the value of an entry and not the name and description that belong to it, you
can use the -o
flag
archwiki-rs info -o
You can generate a completion file to allow tab completion for most popular shells (list of supported shells).
The following example shows how to set up completion for ZSH (with oh my zsh).
archwiki-rs completions > /home/iusearchbtw/.oh-my-zsh/completions/_archwiki-rs
Here's a list of programs that have plugins for archwiki-rs
to make your life easier
Every command/sub-command has a manual page that goes into more detail about the technical
details of the command and its behavior. See man archwiki-rs
to get started.
Keep in mind that not all info in the man pages is guaranteed to be correct. If you find any mistakes you are welcome to let me know or to file a PR.
For the following commands you can use the --json
and --json-raw
flags to get the
output as easily parseable JSON for your program to use:
If you are using Arch Linux a great alternative for this tool is the wikiman
CLI tool
in combination with the arch-wiki-docs
package