Skip to main content

hnterminal

PyPI version

pipx install hnterminal

This CLI tool supports browsing, login, upvote and commenting for full HN experience in the terminal.

Built on top of HN API and replbuilder.

Installation

pipx install hnterminal

$ hnterminal will invoke the terminal command from shell, if pipx installation is in your PATH

You may also run python src/cli.py off current repository.

Usage

The CLI and each of its command have detailed help sections that you can utilize:

help

You can quickly navigate the front page:

front_page

Login and upvote what you like using pointers:

upvote

get_tree use DFS to create a comment tree, you can use this command on any pointer shown. Additionally, -1 pointer is reserved for parent, so you can trace a comment all the way up.

tree_story

Same command used on comments:

tree_comment

You can reply to story or comments utilizing the same pointer, even using an editor to craft your response:

reply_vim

reply_complete

The comment will then show up (the read API will take ~30 seconds to be up to date):

reply_shown

This terminal tool is responsive! and the output will be adjusted to the width of the terminal for everything it displays

responsive browsing

You can also use aliases to shorten most used, repetitive commands:

alias

There are more to this tool, for instance, it has the capability to show user info and history, it enables seamless browsing experience by maintaining a cache which status you can check with cache commands, which you may want to clear from time to time to keep it from going stale if you spend hours in this tool. The ultimate goal is to provide the same HN browsing experience in the terminal.

Usage (No Image)

See a textual demo (color and styles not available via markdown):

aperocky@~$ hnterminal
hnterminal > get_front_page -n 5
POINTER | AUTHOR                   | SCORE | COMMENT | AGE        | BASE URL
1       | Apple: Transformer architecture optimized for Apple Silicon
        | behnamoh                 | 330   | 134     | 3 hours    | github.com
2       | You can't tell people anything (2004)
        | alexslobodnik            | 131   | 53      | 3 hours    | habitatchronicles.com
3       | ChatGPT Plugins
        | bryanh                   | 1393  | 754     | 8 hours    | openai.com
4       | Relativity Space launches first 3D-printed rocket on historic test flight
        | Stevvo                   | 186   | 90      | 9 hours    | www.space.com
5       | I Bought Back My Acquihired Startup
        | mokkol                   | 137   | 41      | 4 hours    | steveridout.com

hnterminal > login USERNAME PASSWORD
Successfully logged in as USERNAME

hnterminal > upvote 4
POINTER 4 is [UPVOTED]

hnterminal > get_tree 4
POINTER -1: PARENT STORY
Relativity Space launches first 3D-printed rocket on historic test flight
2023-03-23 12:28:25
AUTHOR: Stevvo
FULL URL: https://www.space.com/relativity-space-terran-1-test-launch-failure
POINTER/AUTHOR      | COMMENTS
1                   | honestly the most impressive part of relativity space is how young their founder is.
croatiancoder       | 
2023-03-23 12:35:58 | 

2 [UPVOTED]               | Jordan was 22 when they started!!
jessfraz                  | 
2023-03-23 15:14:19       | 

3                               | Damn he’s my age and I’m still a startup engineer while he’s leading rocket
robopsychology                  | engineering lol - what a person!
2023-03-23 18:56:21             | 

4                               | How does a 22 year old get the funding to start something like this?
AnimalMuppet                    | 
2023-03-23 15:53:02             | 

hnterminal > reply_to 1 -e
... opens vim editor ...

EDITOR OUTPUT:
"... whatever you wrote ..."
Comment Published

Metadata

Release files for hnterminal 0.7.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hnterminal 0.7.1
File Size Uploaded Provenance Actions
hnterminal-0.7.1.tar.gz 12.9 kB Without provenance Details for hnterminal-0.7.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hnterminal 0.7.1
File Interpreter ABI Platform Actions
hnterminal-0.7.1-py3-none-any.whl Python 3 none any Details for hnterminal-0.7.1-py3-none-any.whl

Total release size: 28.3 kB

Release files / hnterminal-0.7.1.tar.gz

Download URL hnterminal-0.7.1.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b1f7527888e451e28cff2cb009309ab960f93d39a10df4aa0729429c863cc9a9
BLAKE2b-256 checksum
How to use checksums
5188d7700528a1c0f5d55fcdd9fee7baae22e550414e907fc5ca0d19a7b603dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / hnterminal-0.7.1-py3-none-any.whl

Download URL hnterminal-0.7.1-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2cccbc0525272ac7d8e9102a25fab9f06263ff6b9509fe64320a38bfc5d0496e
BLAKE2b-256 checksum
How to use checksums
dc8a158b8be125a1edb3f9b1fe50b49b390ce62d1e33bee183376cb57313899e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Security for hnterminal 0.7.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page