hn-cli

Crates.iohn-cli
lib.rshn-cli
version0.3.0
sourcesrc
created_at2021-11-24 22:01:25.997541
updated_at2021-12-03 02:59:11.845136
descriptionAnother HackerNews command-line client.
homepagehttps://github.com/scastiel/hn
repositoryhttps://github.com/scastiel/hn
max_upload_size
id487331
size2,786,405
Sébastien Castiel (scastiel)

documentation

README

hn-cli, a command-line tool to read HackerNews

Crates.io Rust

Screenshots

Installation

You’ll need first to install the Rust toolchain, then: cargo install hn-cli

Usage

List stories (add -p3 or --page 3 to display the third page):

  • Top stories: hn or hn top or hn t
  • New stories: hn new or hn n
  • Best stories: hn best or hn b
  • Show HN stories: hn show or hn s
  • Ask HN stories: hn ask or hn a
  • Job stories: hn job or hn j

After listing stories, note the index of the story you are interested in (let’s suppose it is 5), then:

  • Show story details and comments: hn details 5 or hn d 5
  • Open story link in your browser: hn open 5 or hn o 5

You can also display the details about a user with hn user the_user_name or hn u the_user.

To login, use hn login or hn l. The auth token will be persisted to be used in the next commands. Note that to perform write operations (such as upvoting a story), you will need to reload the list of the stories using the commands listed above, such as hn top.

To logout and remove the persisted auth token, use the command hn logout.

Note: information is obtained by scraping the HackerNews website. The reason this crate does not use the official API is that it does not provide a convenient way to get all the comments for a given story, and only allows read operations.

License

MIT, see LICENSE.

Commit count: 29

cargo fmt