Skip to content

Instantly share code, notes, and snippets.

@yogeek
Last active May 15, 2023 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yogeek/5a0fa42fc48df9c651b604a9df9ba79c to your computer and use it in GitHub Desktop.
Save yogeek/5a0fa42fc48df9c651b604a9df9ba79c to your computer and use it in GitHub Desktop.
Charm.sh

Glow

https://github.com/charmbracelet/glow

Install

# for now we use a forked version of the official plugin to fix an issue (https://github.com/chessmango/asdf-glow/pull/1)
asdf plugin install https://github.com/yogeek/asdf-glow/
asdf install glow latest
asdf global glow latest
glow --version

Usage

# in a repo with markdown files : 'glow' will propose to select one of the markdown files to read
glow

# read a specific markdown file
glow README.md

# Fetch README from GitHub / GitLab
glow github.com/charmbracelet/glow

# Fetch markdown from HTTP
glow https://host.tld/file.md

# Read from stdin
echo "[Glow](https://github.com/charmbracelet/glow)" | glow -

Gum

https://github.com/charmbracelet/gum

Install

asdf plugin install gum
asdf install gum latest
asdf global gum latest
gum --version

Usage

#!/usr/bin/env bash

#!/usr/bin/env bash

# gum choose "int" "val" "prod"
# gum confirm "Confirm ?"

ENVIRONMENT=$(gum choose "integration" "validation" "production")
REGION=$(gum choose "eu-central-1" "eu-west-1" "eu-east-1")
CLASSIFICATION=$(gum input --placeholder "prod")

# Since the classification is optional, wrap it in parentheses if it has a value.
test -n "$CLASSIFICATION" && CLASSIFICATION="($CLASSIFICATION)"

# SUMMARY=$(gum input --value "$ENVIRONMENT-$REGION: " --placeholder "Summary of this change")

# Commit these changes
gum confirm "Confirm $ENVIRONMENT-$REGION ?" && \
gum style \
	--foreground 212 --border-foreground 212 --border double \
	--align center --width 50 --margin "1 2" --padding "2 4" \
	"$ENVIRONMENT / $REGION" "Let's go!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment