-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Add charmebracelet-gum feature
#66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,7 @@ jobs: | |
| - atuin.sh | ||
| - btop | ||
| - bun.sh | ||
| - charmbracelet-gum | ||
| - chezmoi.io | ||
| - deno.com | ||
| - feature-installer | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "name": "charmbracelet/gum", | ||
| "id": "gum", | ||
| "version": "1.0.0", | ||
| "description": "Install \"gum\" binary", | ||
| "documentationURL": "https://github.com/devcontainer-community/devcontainer-features/tree/main/src/charmbracelet-gum", | ||
| "options": { | ||
| "version": { | ||
| "type": "string", | ||
| "default": "latest", | ||
| "proposals": [ | ||
| "latest" | ||
| ], | ||
| "description": "Version of \"gum\" to install." | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,143 @@ | ||||
| #!/bin/bash | ||||
| set -o errexit | ||||
| set -o pipefail | ||||
| set -o noclobber | ||||
| set -o nounset | ||||
| set -o allexport | ||||
| readonly githubRepository='charmbracelet/gum' | ||||
| readonly binaryName='gum' | ||||
| readonly versionArgument='--version' | ||||
| readonly downloadUrlTemplate='https://github.com/${githubRepository}/releases/download/v${version}/${name}_${version}_Linux_${architecture}.tar.gz' | ||||
| readonly binaryPathInArchiveTemplate='${name}_${version}_Linux_${architecture}/${binaryName}' | ||||
| readonly binaryTargetFolder='/usr/local/bin' | ||||
| readonly name="${githubRepository##*/}" | ||||
| apt_get_update() { | ||||
| if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then | ||||
| echo "Running apt-get update..." | ||||
| apt-get update -y | ||||
| fi | ||||
| } | ||||
| apt_get_checkinstall() { | ||||
| if ! dpkg -s "$@" >/dev/null 2>&1; then | ||||
| apt_get_update | ||||
| DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends --no-install-suggests --option 'Debug::pkgProblemResolver=true' --option 'Debug::pkgAcquire::Worker=1' "$@" | ||||
| fi | ||||
| } | ||||
| apt_get_cleanup() { | ||||
| apt-get clean | ||||
| rm -rf /var/lib/apt/lists/* | ||||
| } | ||||
| check_curl_envsubst_file_tar_installed() { | ||||
| declare -a requiredAptPackagesMissing=() | ||||
| if ! [ -r '/etc/ssl/certs/ca-certificates.crt' ]; then | ||||
| requiredAptPackagesMissing+=('ca-certificates') | ||||
| fi | ||||
| if ! command -v curl >/dev/null 2>&1; then | ||||
| requiredAptPackagesMissing+=('curl') | ||||
| fi | ||||
| if ! command -v envsubst >/dev/null 2>&1; then | ||||
| requiredAptPackagesMissing+=('gettext-base') | ||||
| fi | ||||
| if ! command -v file >/dev/null 2>&1; then | ||||
| requiredAptPackagesMissing+=('file') | ||||
| fi | ||||
| if ! command -v tar >/dev/null 2>&1; then | ||||
| requiredAptPackagesMissing+=('tar') | ||||
| fi | ||||
| declare -i requiredAptPackagesMissingCount=${#requiredAptPackagesMissing[@]} | ||||
| if [ $requiredAptPackagesMissingCount -gt 0 ]; then | ||||
| apt_get_update | ||||
| apt_get_checkinstall "${requiredAptPackagesMissing[@]}" | ||||
| apt_get_cleanup | ||||
| fi | ||||
| } | ||||
| curl_check_url() { | ||||
| local url=$1 | ||||
| local status_code | ||||
| status_code=$(curl -s -o /dev/null -w '%{http_code}' "$url") | ||||
| if [ "$status_code" -ne 200 ] && [ "$status_code" -ne 302 ]; then | ||||
| echo "Failed to download '$url'. Status code: $status_code." | ||||
| return 1 | ||||
| fi | ||||
| } | ||||
| curl_download_stdout() { | ||||
| local url=$1 | ||||
| curl \ | ||||
| --silent \ | ||||
| --location \ | ||||
| --output '-' \ | ||||
| --connect-timeout 5 \ | ||||
| "$url" | ||||
| } | ||||
| curl_download_untar() { | ||||
| local url=$1 | ||||
| local strip=$2 | ||||
| local target=$3 | ||||
| local bin_path=$4 | ||||
| curl_download_stdout "$url" | tar \ | ||||
| -xz \ | ||||
| -f '-' \ | ||||
| --strip-components="$strip" \ | ||||
| -C "$target" \ | ||||
| "$bin_path" | ||||
| } | ||||
| debian_get_arch() { | ||||
| arch=$(uname -m) | ||||
| # if [[ "$arch" == "aarch64" ]]; then | ||||
| # arch="arm64" | ||||
| # elif [[ "$arch" == "x86_64" ]]; then | ||||
| # arch="x64" | ||||
| # fi | ||||
| echo "$arch" | ||||
| # echo "$(dpkg --print-architecture)" --- IGNORE --- | ||||
|
||||
| # echo "$(dpkg --print-architecture)" --- IGNORE --- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/bash | ||
|
|
||
|
|
||
| set -e | ||
|
|
||
| # Optional: Import test library bundled with the devcontainer CLI | ||
| # See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib | ||
| # Provides the 'check' and 'reportResults' commands. | ||
| source dev-container-features-test-lib | ||
|
|
||
| # Feature-specific tests | ||
| # The 'check' command comes from the dev-container-features-test-lib. Syntax is... | ||
| # check <LABEL> <cmd> [args...] | ||
| check "execute command" bash -c "gum --version | grep 'gum'" | ||
|
|
||
| # Report results | ||
| # If any of the checks above exited with a non-zero exit code, the test will fail. | ||
| reportResults |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commented-out code for architecture mapping should be removed or implemented. The current implementation returns
uname -moutput directly (e.g., 'x86_64', 'aarch64'), which must match the naming convention used in the gum release archives. If the releases use different architecture names, this mapping logic should be uncommented and corrected.