
Text-Based User Interfaces in Go – Beef up your commandline tools - christophberger
https://appliedgo.net/tui/
======
aryehof
Helpful article thanks. My concern with Go is that it particularly suited to
problems in the space of computing, and computer and data science. Like C,
suited to systems programming. What I am unconvinced about yet, is how suited
it is to problems that require the modeling of concepts and their
interactions, an area well suited to object domain models outside of that
sweet spot. I'm aware that the alternative to an object domain model, is a
database model driven by use case based procedural code, which Go could be
argued to be well suited towards.

Is the "package" as the unit of encapsulation a limitation that makes Go
unsuitable to the large scale modeling of concepts in problem domains outside
of the "computer"?

~~~
christophberger
Go is a pragmatic language, designed for programmer productivity. I think Go
was never meant to be used as a language for reasoning about models and
concepts at various abstraction levels and for arbitrary problem domains.
There are certainly other languages available that are better suited for this.

------
lobster_johnson
This is good stuff, but what I'm really looking for, which apparently doesn't
exist, is a terminal lib that doesn't take over the whole screen.

I want to be able to insert temporary widgets that can then be removed, and I
want to continue to treat the terminal as a long ream of text. For example,
like this:

    
    
        $ my-program --verbose
    
        Hello! Enter a choice:
    
        > 1. Intergalactic warfare
          2. The Egyptian Book of the Dead
          3. Meatballs
    

The user should be able to use the keyboard's arrow keys to select stuff. When
selected, I want the remove the whole menu and continue from there:

    
    
        $ my-program --verbose
    
        Thanks, you selected meatballs.
    
         Grinding meat
        * Heating         [######---] 5%
        * Mixing spices   [##-------] 15% (5g/sec)
          Packaging
          Shipping
    

When _that_ , which is a kind of multi-step progress bar, is done, I want to
delete and continue. And so on.

I also want to show prompts, with autocompletion ("dropdowns"), and other
things you typically want to users to be able to do.

If anyone has seen Docker's CLI, they do something like this, by writing one
line per layer and updating each line in parallel, but without taking over the
screen. I assume they use some ANSI escape sequences to position the cursor,
but I've never investigated.

I haven't found anything which packages the above functionality into a nice
library, however.

------
christophberger
Argh! Forgot to include the "golang" keyword :)

