I'm trying out gum (charm.sh) for my shell scripts and it's cool

Hey all, I have seen some of the charm.sh applications and the BubbleTea framework before but I didn’t know about Gum. It calls a single Go binary to enable fairly extensive interactions for a shell script. You don’t write any Go.

I’m going to test it out for a couple interactive helper scripts that I use. Just wanted to share in case anyone was interested. Sorry it’s old gnuws!

4 Likes

I don’t think it’s been discussed in the community so far, looks useful for script UIs! Let us know if you make anything cool with it

I don’t know about cool but I did scratch my own itch. I made a small script to add photos to my Hugo static site and capturing tagging information easier. The forum doesn’t support the video formats I tried uploading so here’s a link to 1 min demo on Mastodon:

2 Likes

Cool!

But you could also stay within Emacs and use completing-read :wink:

(defun forum/shom/completing-read-example ()
  "Just a quick example how to use `completing-read' instead of gum."
  (interactive)
  (let* ((kind (completing-read "Film Poster: " '("color" "b&w")))
         (format (completing-read "" '("35mm" "medium format")))
         (camera (completing-read "" '("Canon Q17 GIII"
                                       "Kiev 60"
                                       "Olympus 35 RC"))))
    (message "Kind: %s, %s from %s" kind format camera)))

check

Kidding aside, that certainly looks like a nice tool for getting a selection within your own shell scripts :+1:

4 Likes

This could make a really nice git shell replacement…

1 Like

My bad for suggesting there was a mythical place called outside Emacs, I’ll consider myself banished from the kingdom :wink:

Thanks for showing me completing-read, that’s cool, I might use it for other things.

2 Likes

Yeah, there are some neat git use cases, especially searching for commit hashes based on commit messages, etc. I generally use magit for everything that’s non-trivial git. While that’s true, I’m also trying to earn my way back into the good graces of the community :stuck_out_tongue_closed_eyes:

1 Like

You’re welcome :slight_smile: . Keep in mind that the appearance and behavior of completing-read depends on other packages. My demo shows how completing-read looks like when used with vertico.