cd-surfer: A simple TUI file explorer

cd-surfer is a replacement for the endless cd ls cd ls ... cycle on linux shells. It is meant to be a simple and fast Text-based User Interface file manager.

Here is the link to cd-surfer´s Github repo

Some features:

  • No dependencies, single binary
  • Fast navigation, less keytrokes than cd / ls
  • Easy in-folder search (just start typing)
  • Should be easy to integrate with any shell (currently it only supports bash)

In-folder search demo:

Despite that it is still lacking a lot o features I want, for a weekend project it is good enough to use in my daily routine. Besides, I do not want to make it bloated, so I will keep it simple, focusing on its core features.

Install

Follow the Github page instructions to get it installed

A few words on its implementation

I wrote cd-surfer in Go, using, the very interesting library, bubbletea.

Bubbletea has a similar approach of React, applied to text UIs. You must define a model, which holds its current state and the View will be rendered based on the model´s attributes. Differently from the usual imperative approach, in which you have to re-assemble parts of the View according the received events.

This philosophy makes the complexity of the UI way more manageable, but, as in React, it comes with a performance penalty.

I noticed that too much formatting impacts a lot on performance, mainly when scrolling a folder with many files. Because of that, I removed most calls to lipgloss, another library from the same authors of bubbletea, focused on terminal formatting, that I was using initially.

Oddly, another thing that impacted on performance on bubbletea rendering was when I used underline or bold formatting, so I striped that from my code as well.

After I removed these problematic formatting the performance improved a lot. It still have some flicker on scrolling, but in a way more acceptable level


Publicado

em

por

Comentários

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *