top | item 33192518

Show HN: Circumflex, browse HN in your terminal

180 points| bensadeh | 3 years ago |github.com

Some two years ago, I found myself spending a lot of time in the terminal between learning vim and discovering new command line tools. I was surprised to see that the niche of HN clis was (relatively) small, and so I decided to write my own command line tool for browsing HN called `circumflex`(`clx`).

`clx` is written in Go using Bubble Tea[1]. You can read the comment section or the linked article in reader mode in the pager `less`.

Using `lesskey` to add custom keybindings, the replies can be collapsed and expanded in real-time (but not individual replies, only all replies at once). Behind the scenes I am appending invisible unicode characters to each line so that I can use the custom keybindings to filter them out. The same technique is used to allow for jumping between top-level comments.

I spent a lot of time thinking about syntax highlighting and finding relevant bits to highlight while also not going overboard with colors. The end result is highlighting of things I find useful for providing context in the comment section, like indicating parent poster and original poster, coloring references, coloring indentations as well as formatting YC startups.

Other quality of life features include adding submissions as favorites (it is stored as a pretty-printed json so you can check it into your vcs to allow for readable diffs). Submissions are marked as read and new comments are indicated with a bullet point.

[1] https://github.com/charmbracelet/bubbletea

63 comments

order

luke8086|3 years ago

Very cool project! Definitely going to check it out.

If you don't mind a bit of a shameless plug, I've also recently built a terminal client for HN [1], although with a slightly different objective - to make it look less like a website, and more like a traditional mail/news reader (i.e. mutt/slrn)

It's not going to have any advanced features because I mostly wrote it for my own use, but maybe someone finds it useful.

[1] https://luke8086.neocities.org/retronews.html

epilys|3 years ago

Here's a single file, no dependency nntp / Usenet server library in python3 I wrote. It includes an HN gateway as an example. I have used it with slrn (tui), meli (tui), pan (gui) and thunderbird (gui)

https://github.com/epilys/nntpserver.py

dusted|3 years ago

This is neat, but.. HN is already a really snazzy looking website in elinks and the other terminal browsers :)

GekkePrutser|3 years ago

That looks like a really nice client, thanks for writing it. I'll try it out.

I'm very happy with glider on mobile but still looking for something in the terminal.

xcambar|3 years ago

I've just installed Glider to write this comment. Thanks for the recommendation!

darkteflon|3 years ago

Sadly, Android only.

9dev|3 years ago

This is a fantastic case study in great text-only user Interfaces. Rarely do you see someone getting so many details right.

soebbing|3 years ago

I really like this client, but I get this error every time I open a link or comments:

  There is no lesskey-src=/var/folders/sv/<filename> option ("less --help" for help)
  Press RETURN to continue
Less version information:

  less --version
  less 581.2 (POSIX regular expressions)
  Copyright (C) 1984-2021  Mark Nudelman
(Edit: formatting)

bensadeh|3 years ago

`clx` depends on the latest version of `less` which at the moment is v 608. Can you update to the latest version and see if you still get the same error message?

doix|3 years ago

This is awesome! I only wish the comments were more integrated, so that j/k moved selection between comments and I could collapse trees at any depth (rather than having h/l toggle all collapses).

But I guess that would mean moving away from less for the comments.

bensadeh|3 years ago

Yes, collapsing specific replies is a bit of a limitation at the moment, but moving between comments with j/k is something that can be implemented!

anupj|3 years ago

Great UI, easy to use (especially for Vim users). Thanks for building this.

msravi|3 years ago

Looks very cool... But it doesn't seem to be getting/displaying any of the comments. Anything I press <enter> on always gives me 0 comments 0 points

https://imgur.com/a/4PrpwTc

I installed using brew on linux mint. The "correct" version of less seems to be in the path

  ~$ less --version
  less 608 (PCRE2 regular expressions)
  Copyright (C) 1984-2022  Mark Nudelman

bensadeh|3 years ago

Not good. Would you be able to open a ticket on GitHub? It would be easier to continue the troubleshooting from there.

justaj|3 years ago

I like using 3rd party HN tools and was thinking to try terminal clients.

From the top of my head this is my personal list of minimum requirements such an app would have to support:

1. Text search within all of comments in a thread.

2. Easy command collapse/expand workflow when viewing threads.

Glancing through the doc it seems that this app doesn't (yet) support either of these requirements, is this correct?

bensadeh|3 years ago

1. The cool thing about using `less` as the pager is everything you get out of the box, including search. Search from within less with `/`.

2. You can collapse / expand the comment section with h/l or left arrow and right arrow. The limitation to this is that it is not possible to collapse specific threads / replies, only all replies at once.

heliostatic|3 years ago

Love this! Bubbletea is a great library for TUIs. I've been a long time user of hnterm (https://github.com/ggerganov/hnterm) which has a nice feature for collapsing comment threads, but doesn't look as nice otherwise.

jbverschoor|3 years ago

The clarity, the focus. Oh how I love text UI. I'm tired of having flashy magazines as the front-end of my applicatkions

replwoacause|3 years ago

Any chance you could make it possible to have Circumflex open a HN link? A popup/input to paste a URL into or command line parameter that takes a URL argument? I often discover submissions via Google and would love to be able to view them in Circumflex.

clx -u --url OR clx -l --link

bensadeh|3 years ago

You can do this from the command line with `clx view [id]`. This was in the readme before, but I seem to have removed it when I last restructured the page. If you want to read the article in reader mode it is `clx read [id]`.

hackarama|3 years ago

Panics with "Could not determine terminal width" on Windows 10 using cmd.exe

owenpalmer|3 years ago

I'm having the same issue

NiloCK|3 years ago

Looks great at first glance, but as far as ctrl-f can tell, there is no login and I assume no ability to post / reply, and no respect for noProcrast settings.

Any interest in adding logged-in-user effects?

nidnogg|3 years ago

Not quite related to the tool itself, but great job on those README.md screencaps. For some reason the slight shadowing was a really nice touch.

lioeters|3 years ago

Looking in the raw Markdown file, I see the shadowing is not done with CSS, it's included in the PNG image with transparency.

alexmolas|3 years ago

Now I can browse HN without my boss noticing it ;)

qingfengasahi|3 years ago

I hope rust also has such a UI library

_ph_|3 years ago

Looks nice, but why AGPL-3? Most of the used libraries are MIT/BSD.

Normille|3 years ago

Looks interesting. Any plans to make it available through MacPorts?

bensadeh|3 years ago

I would love to bring this to more package managers, including MacPorts!

imiric|3 years ago

Looks great! Will give it a try.

Any plans for adding login and posting support?

bensadeh|3 years ago

Right now it is somewhat out of the scope of this project as I am using less for viewing everything. But it would be great down the line to write replies in your favorite terminal editor all from within clx!

replwoacause|3 years ago

This is well done! I am loving browsing HN with it.

arthurcolle|3 years ago

What font is in the screenshots? I like it

math-dev|3 years ago

How to install on linux for a newbie?

And damn you so awesome!

bensadeh|3 years ago

Thank you!

On linux you can still install with homebrew[1], but if you prefer you can install from source as well. Follow the installation instruction for installing Go, maybe your distro has a preferred way. Then you can clone the repo and either 1. install the binary with `go install` (make sure $GOPATH/bin in in your path variable) or 2. run with `go run main.go`.

On a side note, I am looking for help to add `clx` to linux package managers.

[1] https://docs.brew.sh/Homebrew-on-Linux

d4rkp4ttern|3 years ago

Octal is my fav iOS HN client

joshxyz|3 years ago

this is too good to the eyes

trasz|3 years ago

I’d love to see a HN<->NNTP bridge. This would make it possible to use standard Usenet readers, which provide vastly superior functionality, from proper threading to scoring.

notacoward|3 years ago

NNTP is one of the most under-rated internet protocols IMO. Solved a lot of problems that are worth solving, even in domains even further from its original purpose than this. Also, if I could use a news reader for HN I could take advantage of a local killfile. ;)