7 ms·
Show HN: Circumflex, browse HN in your terminal
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 https://github.com/charmbracelet/bubbletea
- GekkePrutser 4y agoThat 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 4y agoI've just installed Glider to write this comment. Thanks for the recommendation!
- darkteflon 4y agoSadly, Android only.
- _emacsomancer_ 4y agoHacki is also nice, and looks like it works on both Android and iOS. https://github.com/Livinglist/Hacki https://github.com/Livinglist/Hacki
- smcleod 4y agoI tried this one out the other day but it felt very non-native - similar to other Flutter apps I've tried.
- jer0me 4y agoI like HACK on iOS
- GekkePrutser 4y agoOh yeah good point, I didn't realise it was not available for iOS as I don't use that. But I'm sure iOS has other good clients as people say, especially because this site is very US-developer centric which is an iOS stronghold in terms of marketshare :)
- joshxyz 4y agothis is too good to the eyes
- alexmolas 4y agoNow I can browse HN without my boss noticing it ;)
- soebbing 4y agoI 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 4y 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?
- mixmastamyk 4y agoLatest buntu/mint at 590.
- soebbing 4y agoYou're right, updating to less v608 fixed the issue! Thanks a lot! Maybe you can add a check in clx and show a message, in case the version of less is too old? For the record: less v581.2 is the one being shipped by macOS 12.6 Monterey, I simply updated with "brew install less"
- bensadeh 4y agoGreat! Thank you for letting me know! I should add a check and also update the brew formula to fetch the latest version of less as well.
- werid 4y agomy freebsd less is 563. stable debian is 551. less 608 was releaseed september 2nd 2022... this happens so often... i find a new cool cli tool, only for it to have a dependency on a newer version of something. so i can't use it until next OS upgrade, and by then, i've forgotten about it cause i never got to test it out. i guess devs just don't use OS packages and compile every single tool they use? i used to do that, when i used slackware in the '90s.
- imiric 4y agoLooks great! Will give it a try. Any plans for adding login and posting support?
- bensadeh 4y agoRight 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!
- doix 4y agoThis 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 4y agoYes, 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!
- dgl 4y agoIt would be nice if this used OSC 8[1] (less supports it) so that there is an easy way to click a link if I want to go to my actual browser. [1]: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3c...
- bensadeh 4y agoThanks for the suggestion! That would indeed be very useful!
- nidnogg 4y agoNot 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 4y agoLooking in the raw Markdown file, I see the shadowing is not done with CSS, it's included in the PNG image with transparency.
- bensadeh 4y agoThis actually comes out of the box for the system screenshot tool in macOS (Cmd + Shift + 4 and then Space to select window). The screenshot of the window will then have this shadowing around it.
- lioeters 4y agoOoh right, I remember seeing that by chance before. Thanks for the clarification.
- dgl 4y ago[32mDoes this mean HN can support color text now?
- dgl 4y agoAnswer: Yes. https://imgur.com/a/DlrEbvI https://imgur.com/a/DlrEbvI
- 9dev 4y agoThis is a fantastic case study in great text-only user Interfaces. Rarely do you see someone getting so many details right.
- qingfengasahi 4y agoI hope rust also has such a UI library
- anupj 4y agoGreat UI, easy to use (especially for Vim users). Thanks for building this.
- danielmr6 4y agoAmazing!
- math-dev 4y agoHow to install on linux for a newbie? And damn you so awesome!
- bensadeh 4y agoThank 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 https://docs.brew.sh/Homebrew-on-Linux
- math-dev 4y agoThanks!
- Normille 4y agoLooks interesting. Any plans to make it available through MacPorts?
- bensadeh 4y agoI would love to bring this to more package managers, including MacPorts!
- jbverschoor 4y agoThe clarity, the focus. Oh how I love text UI. I'm tired of having flashy magazines as the front-end of my applicatkions
- dusted 4y agoThis is neat, but.. HN is already a really snazzy looking website in elinks and the other terminal browsers :)
- luke8086 4y agoVery 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 https://luke8086.neocities.org/retronews.html
- epilys 4y agoHere'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 https://github.com/epilys/nntpserver.py
- _ph_ 4y agoLooks nice, but why AGPL-3? Most of the used libraries are MIT/BSD.
- justaj 4y agoI 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 4y ago1. 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.
- justaj 4y 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 `/`. Sure, but doesn't this assume running `less` in this case only to search specific text strings? So this means if you wanted to apply any other operations, you'd have to exit out of the $PAGER back into the main terminal app? What if I wanted to combine it with other operations such as collapse / expand comments? Speaking of: > 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. So an collapse / expand operation is applied to _all_ comments in a thread? Hmm, in that case for me in terms of usability the browser is still superior.
- trasz 4y agoI’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 4y agoNNTP 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. ;)
- d4rkp4ttern 4y agoOctal is my fav iOS HN client
- msravi 4y agoLooks 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 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 4y agoNot good. Would you be able to open a ticket on GitHub? It would be easier to continue the troubleshooting from there.
- NiloCK 4y agoLooks 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?
- hackarama 4y agoPanics with "Could not determine terminal width" on Windows 10 using cmd.exe
- owenpalmer 4y agoI'm having the same issue
- replwoacause 4y agoThis is well done! I am loving browsing HN with it.
- replwoacause 4y agoAny 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 4y agoYou 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]`.
- replwoacause 4y agoNice. Thanks!
- heliostatic 4y agoLove this! Bubbletea is a great library for TUIs. I've been a long time user of hnterm (https://github.com/ggerganov/hnterm https://github.com/ggerganov/hnterm) which has a nice feature for collapsing comment threads, but doesn't look as nice otherwise.
- arthurcolle 4y agoWhat font is in the screenshots? I like it
- gravlaks 4y agoPretty nice!