Open pcbowers opened 1 year ago
In fact, another example would be Chezmoi's Installation Script which may operate as a great starting point to implement this considering it's a Bubble Tea application and lists some other resources within the script that helped inspire its creation.
There is an extremely handy project from @egoist called https://github.com/egoist/bina which makes this incredibly simple - for example, here's some boilerplate you can use for charmbracelet/gum
:
#!/bin/sh
set -e
GUM_TMP="$(mktemp -d)"
GUM_BIN="${GUM_TMP}/gum"
curl -fsSL "https://bina.egoist.dev/charmbracelet/gum?dir=${GUM_TMP}" | sh
password="$(${GUM_BIN} input --password --placeholder 'what is the password')"
echo "your password is: ${password}"
Is your feature request related to a problem? Please describe.
I would like to use gum to create a script that helps setup new machines. While gum is POSIX-compliant, it does require installation before usage. Rather than providing multiple ways to install gum on the various supported machines, it would be helpful to have a snippet that could be placed at the front of any script using gum that would install it if it is not already installed regardless of OS/Platform (as discussed in #118).
Describe the solution you'd like
I looked around to see how other open source projects handle installation. While some do place the responsibility on the user (like gum currently does), others abstract this using their own installation scripts. Some examples include Tailscale's Installation Script and Starship's Installation Script. However, there are several other examples out there that may serve as better starting points for gum specifically. This would make a one-line installation possible, making gum much easier to add as a dependency to a bash script while remaining portable.
Describe alternatives you've considered
I can't think of any other alternatives to make this possible, but am open to suggestions!
Additional context
N/A