This is a very nice project, just a one issue. I know npm install is very convenient and nice but I'm wary of installing anything that my package manager doesn't know about(through npm, pip, make install, etc.)
Could you make a PKGBUILD and upload the package on AUR. You can still use npm install, for example check this package
So I'm learning node and wrote this to get better with promises and because I didn't like the existing solutions much for command-line arch wiki browsing.
First you need Node. Then install this with npm install -g arch-wiki-man, which will also save a local copy of all the wiki articles in markdown on your drive (it gets updated with changes to the wiki every two days, run the install command again in the future to fetch those updates).
Once installed, do an awman -h for usage details. Options are search in descriptions with -d, apropos-style in-content search with -k and open articles in your browser rather than man with -w.
I'm not sure if this is just useful for me or for others too but here it is :) If you do like it, drop me a star on github :)
So you know of arch-wiki-markdown-git? I've been using the updated branch for a while, which supports live-generation from the wiki and generating from arch-wiki-docs. What are the advantages of your solution over that package?
Oh wow, I hadn't seen this before but I have seen arch-wiki-docs as there are links to it in the wiki. For some reason I never got it working on my machine though, maybe due to an issue with python 2/3 on my end. And I can't seem to install arch-wiki-markdown-git either as I get dependency conflicts with vim and my neovim setup is too precious for me right now to risk screwing up! I definitely will take a better look at it later though. Based on a cursory glance at it, those repos you linked look better and more robust when it comes to the generation of the wiki so when I find some time, I will address my issues and get it to work - and maybe borrow some ideas.
As for advantages of my approach, looking at the readme, it doesn't sound like there is a selection menu, which mine does have. I also allow for searching for a matching article in the descriptions (which is usually the first paragraph of the article) with -d and and in the contents of every article with -k. And of course it converts the selected article on the fly to roff and displays it in man. Oh, and you can also open the articles in your web browser instead of man with -w.
So yeah, in short I think the wiki generation is better in the ones you linked, but maybe my command-line interface is a little nicer?
The underlying scraper I wrote before Christmas to get the articles off the Arch Wiki is also on github here.
Right now it's hardcoded for the Arch Wiki, but as long as a wiki has a TOC and a last changes page, it shouldn't be too difficult to modify the code so it scrapes a different wiki. However I'm pretty sure scraping a much bigger one with this wouldn't end well, the code would have to be optimized first because right now it's keeping everything in memory as it steps through chains of promise arrays. I might do some more refactoring later on but feel free to fork and give it a shot (beware of shoddy code in this older repo though! :)
I had no idea that existed. People keep pointing me to stuff that I totally missed! :)
Anyway, that's pretty nifty. The difference is the wiki generation that solution uses is better (until I update mine that is), but my command-line interface is probably nicer. When you have multiple matches, you get a little menu to choose an article from with arrow keys or vim keybindings and it opens the result in straight man (or in your web browser if you prefer). You can also search for matches just in titles, in descriptions or in the entire article contents. Oh and in mine, the matches are ordered by last update, which I think works well as a proxy of importance of the article.
Yes, it depends on my arch-wiki-md-repo which holds a local copy of all the articles in markdown and a little json database to search in. So install it once and it runs offline (well obviously the open in browser option won't work without Internet)
Dude, this is fucking genius. I've always wanted something like this without fully realizing it could be made. This is gonna be one of my default installed packages from now on. Thanks a lot!
Haha glad you like it! I'll be pushing an update next week or so which among other things should fix some of the formatting issues so don't forget to update later on :)
36 comments
This is a very nice project, just a one issue. I know npm install is very convenient and nice but I'm wary of installing anything that my package manager doesn't know about(through npm, pip, make install, etc.)
Could you make a PKGBUILD and upload the package on AUR. You can still use npm install, for example check this package
Makes sense, I'll do this later tonight or tomorrow and will reply to this thread to let you know.
Thank you very much, I appreciate it.
So I'm learning node and wrote this to get better with promises and because I didn't like the existing solutions much for command-line arch wiki browsing.
First you need Node. Then install this with
npm install -g arch-wiki-man, which will also save a local copy of all the wiki articles in markdown on your drive (it gets updated with changes to the wiki every two days, run the install command again in the future to fetch those updates).Once installed, do an
awman -hfor usage details. Options are search in descriptions with-d, apropos-style in-content search with-kand open articles in your browser rather thanmanwith-w.I'm not sure if this is just useful for me or for others too but here it is :) If you do like it, drop me a star on github :)
edit-- Woo, thanks for the gold!!
edit2-- It's now also available on the AUR
So you know of arch-wiki-markdown-git? I've been using the updated branch for a while, which supports live-generation from the wiki and generating from arch-wiki-docs. What are the advantages of your solution over that package?
Oh wow, I hadn't seen this before but I have seen
arch-wiki-docsas there are links to it in the wiki. For some reason I never got it working on my machine though, maybe due to an issue with python 2/3 on my end. And I can't seem to installarch-wiki-markdown-giteither as I get dependency conflicts with vim and my neovim setup is too precious for me right now to risk screwing up! I definitely will take a better look at it later though. Based on a cursory glance at it, those repos you linked look better and more robust when it comes to the generation of the wiki so when I find some time, I will address my issues and get it to work - and maybe borrow some ideas.As for advantages of my approach, looking at the readme, it doesn't sound like there is a selection menu, which mine does have. I also allow for searching for a matching article in the descriptions (which is usually the first paragraph of the article) with
-dand and in the contents of every article with-k. And of course it converts the selected article on the fly to roff and displays it inman. Oh, and you can also open the articles in your web browser instead ofmanwith-w.So yeah, in short I think the wiki generation is better in the ones you linked, but maybe my command-line interface is a little nicer?
:O Works wonderfully. Thanks for the program.
This is great! I'm going to give this a try once I get home.
If we can get enough votes, I could easily see this getting into community.
Hey, this is pretty spiffy. Is it easy to adapt to other wikis? Like wikipedia or wikihow?
As is, this is pretty fantastic, but a generic, caching wiki* reader sounds even better. :-D
The underlying scraper I wrote before Christmas to get the articles off the Arch Wiki is also on github here.
Right now it's hardcoded for the Arch Wiki, but as long as a wiki has a TOC and a last changes page, it shouldn't be too difficult to modify the code so it scrapes a different wiki. However I'm pretty sure scraping a much bigger one with this wouldn't end well, the code would have to be optimized first because right now it's keeping everything in memory as it steps through chains of promise arrays. I might do some more refactoring later on but feel free to fork and give it a shot (beware of shoddy code in this older repo though! :)
I'm curious why you chose to scrape articles rather than use the API?
Fantastic.
Did someone call my name?
So, what's the difference between this and arch-wiki-lite, which is already in the community repo (not AUR)?
I had no idea that existed. People keep pointing me to stuff that I totally missed! :)
Anyway, that's pretty nifty. The difference is the wiki generation that solution uses is better (until I update mine that is), but my command-line interface is probably nicer. When you have multiple matches, you get a little menu to choose an article from with arrow keys or vim keybindings and it opens the result in straight
man(or in your web browser if you prefer). You can also search for matches just in titles, in descriptions or in the entire article contents. Oh and in mine, the matches are ordered by last update, which I think works well as a proxy of importance of the article.Holy shit, this is beautiful! Thanks so much for this
Glad you like it! :)
OKAY, gotta admit, this is awesome!
What's offline about it? Does it scrape/mirror the entire arch wiki locally?
He has a git repo with the whole arch wiki in it.
Yes, it depends on my
arch-wiki-md-repowhich holds a local copy of all the articles in markdown and a little json database to search in. So install it once and it runs offline (well obviously the open in browser option won't work without Internet)ah. once installed, do you have to manually sync it to keep it up to date?
arch-wiki-md-repolooks cool. With some link reworking magic it could be used with mdwiki and would provide totally offline wiki in the browser.Dude, this is fucking genius. I've always wanted something like this without fully realizing it could be made. This is gonna be one of my default installed packages from now on. Thanks a lot!
Haha glad you like it! I'll be pushing an update next week or so which among other things should fix some of the formatting issues so don't forget to update later on :)