1. 64

  2. 9

    Been toying with Charm libraries lately. They are a fresh take on creating cli tools. Lip Gloss makes it more awesome.

    I recommend it. I’m using it now for my tiny app helping me with cloning the latest project I forked. Skipping the flow copying the url and paste in the terminal with git clone.

    1. 3

      Yes, I’ve been looking to Charm to create a cli interface for something like an email client. It looks very promising, and the API is pretty nice to work with.

      1. 3

        Keep in mind that the API works with strings at the core, and terminal features are kind of auxiliary (using termenv). There’s the scroll-based renderer but it seems like a hack. tcell’s mutable cell buffer API is probably more robust and performant (strings take more memory than slices to concatenate etc.), though it is not thread-safe. I had a shot “porting” Bubbletea to tcell, but it didn’t really get off the ground. The abstraction is much more complicated: a 2d slice of structs rather than a string

        See also: https://github.com/charmbracelet/bubbletea/issues/21#issuecomment-718921102

      2. 2

        How does distribution work? Do you have to compile the Go app for all the OSs and architectures you want to support?

        1. 2

          Basically, yes. Go has pretty good cross-compilation support so this isn’t too onerous.

          Alternatively, if the end user has Go installed, they can download/build/install a program with one command — IIRC it’s go install + the Git URL. (I haven’t used Go in a few years so I’m not certain of the syntax.)

      3. 9

        It makes me sad all we keep doing with the CLI is putting more and more lipstick on the pig of the vt100. Why are we still caring about character cells and escape sequences? Don’t we have the imagination and ability to come up with something better?

        1. 2

          I do like seeing modernized terminal tools — lipstick does improve usability, and aesthetics are valuable too for their own sake — but I agree that CLIs are sort of stuck in the past.

          Do you have any ideas of what would be better?

          The only really different CLI I’m familiar with was Apple’s MPW, the old dev environment for pre-Mac OS X. Its GUI was a standard programmer’s text editor, like BBEdit/Sublime/TextMate/etc, with the extra feature that pressing Cmd-Return, or the keypad Enter key, would evaluate the text on the current line (or the selected text) as a shell command. Command output was inserted following the command line. Pressing Undo after running a command would undo the insertion of the output.

          This had a lot of nice benefits, like being able to re-run an old command by scrolling back up to it, clicking and hitting Enter. Usually you had a window open with a bunch of common commands you’d invoke that way. It also meant that editing command lines was exactly like editing any other text, and fully mouse-aware.

          One detail I remember was that the ‘make’ command defaulted to writing the build commands to stdout without running them. Then you could look them over and select & run them with a few keystrokes, or modify them if you wished.

          (After writing this I realize that modern editors probably have a feature like this; but I never hear about anyone using it, so I guess it’s not popular?)

          1. 3

            One thing we must remember is that command line is not in opposition to GUI.

            1. 1

              Yes, this. Emacs, Mathematica, CLIM, etc. all provide nice counterpoints to the supposed dichotomy.

              1. 1

                True confession: I only recently discovered (via the micro editor) that terminal programs can interact with the mouse … that blew my mind. It opens up a lot of possibilities.

            2. 2

              MPW is pretty interesting; from what I remember, a lot of it was developed by former Apollo people, who had experience with the pad shell/editor. (Me and a friend are doing a lot of Apollo research, so it’s fresh in the mind.)

              1. 2

                Sounds like a less powerful version of the middle-click in Acme. I found it very useful myself, it encourages you to make a project-local scratchpad rather than make loads of context-sensitive keybinds.

                I guess in Vim, you can do :'<,'>w ! sh for a visual selection (never used this though)

                1. 3

                  Acme got it all from Oberon.

                  Honestly, I think Emacs has a lot of interesting ideas, but it’s trapped in what’s basically an ITS/lispm curmudgeon refugee camp that will likely never evolve or spread; I myself have a hard time using Emacs. That’s a shame, because it traps a lot of those ideas.