Hacker News new | ask | show | jobs
by 2211 2712 days ago
The entire program was rewritten and the source is now highly readable. The rewrite also made features like 'LS_COLORS' support possible. A lot of optimization was done and the program no longer redraws the entire screen per key-press[!].

For those wondering "Why bash?"; I wanted something I could 'wget'/'curl' on other machines that would "just work". The program only requires 'bash 3+' and a POSIX compliant 'coreutils' to function. Also, it's really fun to push bash to its limits!

I'm the developer, happy to answer any questions.

Note: I noticed this has been posted before so I added a '#' to bypass the filter. I think this merits a re-post as the project is 100% different to how it was before. The old program was 100~ lines of obfuscated spaghetti and the new program is around 700~ lines of commented "well structured" code.

2 comments

The obfuscation wasn't that bad, I recall it was quite fun to parse through for inspiration while trying to implement a similarly spirited file manager, only in posix-compliant shell (well, at least in `dash`). No arrays were a major pain point, and mainly why I gave up halfway.

Anyways, thanks for the `fff` rewrite, it's pretty wonderful.

You could probably pull it off in POSIX sh if you basically made a file manager TUI around 'ls' (this isn't a bad idea actually). ;)
This is very cool, thanks for resubmitting it, I actually checked out the source code this time, as opposed to last time only reading the readme.

Having learned all that you needed to in order to write (and rewrite) this, do you have any similar future projects in the works?

I'm working on a guide that will cover the entire process of creating a terminal user interface in bash. I want to create a central location for the information I've gathered so it may be of benefit to others.

I also hope that people will contribute their own snippets, methods and ideas. It'd be great to find out if there are better ways of implementing the code.

The guide is on GitHub [0] and is a heavy work in progress. Its currently structured in a way I'm not too happy with. I want to change it to a series of 'How to implement x' instead of an ever growing implementation.

Other than the TUI guide I have 4 other major projects which I am working on (neofetch, pywal, fff and the Pure Bash Bible).

[0] https://github.com/dylanaraps/writing-a-tui-in-bash

Along those lines, I think a heavily commented version of fff would be a great learning tool. The concepts of fff are simple enough that anyone could follow along easily without really having to learn fff first. This idea came partly from the fact that when I tried reading fff's new source code yesterday, while knowing exactly what fff does and understanding the comments completely, I was still pretty lost as to what it was doing and how it worked.