From b2534f0b67ce563d2fa13df13efb8d355be7a48d Mon Sep 17 00:00:00 2001 From: cirolosapio Date: Tue, 7 May 2024 13:09:19 +0200 Subject: [PATCH] Revert "chore: Remove Alpine GitHub Copilot CLI feature" This reverts commit 5b1491c8347a7ecf74a30d26027cbd8942348185. --- src/alpine-gh-copilot-cli/README.md | 27 ++++++++++++++ .../devcontainer-feature.json | 20 +++++++++++ src/alpine-gh-copilot-cli/install.sh | 35 +++++++++++++++++++ 3 files changed, 82 insertions(+) create mode 100644 src/alpine-gh-copilot-cli/README.md create mode 100644 src/alpine-gh-copilot-cli/devcontainer-feature.json create mode 100644 src/alpine-gh-copilot-cli/install.sh diff --git a/src/alpine-gh-copilot-cli/README.md b/src/alpine-gh-copilot-cli/README.md new file mode 100644 index 0000000..d7580c9 --- /dev/null +++ b/src/alpine-gh-copilot-cli/README.md @@ -0,0 +1,27 @@ + +# alpine-gh-copilot-cli (alpine-gh-copilot-cli) + +Installs Github Copilot CLI on alpine + +## Example Usage + +```json +"features": { + "ghcr.io/cirolosapio/devcontainers-features/alpine-gh-copilot-cli:0": {} +} +``` + + + +## Customizations + +### VS Code Extensions + +- `GitHub.copilot-chat` +- `GitHub.copilot` + + + +--- + +_Note: This file was auto-generated from the [devcontainer-feature.json](https://github.com/cirolosapio/devcontainers-features/blob/main/src/alpine-gh-copilot-cli/devcontainer-feature.json). Add additional notes to a `NOTES.md`._ diff --git a/src/alpine-gh-copilot-cli/devcontainer-feature.json b/src/alpine-gh-copilot-cli/devcontainer-feature.json new file mode 100644 index 0000000..b6378c9 --- /dev/null +++ b/src/alpine-gh-copilot-cli/devcontainer-feature.json @@ -0,0 +1,20 @@ +{ + "name": "alpine-gh-copilot-cli", + "id": "alpine-gh-copilot-cli", + "version": "0.0.14", + "description": "Installs Github Copilot CLI on alpine", + "documentationURL": "https://github.com/cirolosapio/devcontainers-features/tree/main/src/alpine-gh-copilot-cli", + "installsAfter": [ + "ghcr.io/cirolosapio/devcontainers-features/alpine-user", + "ghcr.io/cirolosapio/devcontainers-features/alpine-bash", + "ghcr.io/cirolosapio/devcontainers-features/alpine-ohmyzsh" + ], + "customizations": { + "vscode": { + "extensions": [ + "GitHub.copilot-chat", + "GitHub.copilot" + ] + } + } +} \ No newline at end of file diff --git a/src/alpine-gh-copilot-cli/install.sh b/src/alpine-gh-copilot-cli/install.sh new file mode 100644 index 0000000..57f5661 --- /dev/null +++ b/src/alpine-gh-copilot-cli/install.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +set -e + +echo "Activating feature 'alpine-gh-copilot-cli'" + +apk --no-cache add npm +npm i -g @githubnext/github-copilot-cli + +if command -v zsh &> /dev/null || command -v bash &> /dev/null; then + if command -v zsh &> /dev/null; then + RC_PROFILE=".zshrc" + else + RC_PROFILE=".bashrc" + fi + + CURRENT_USER=$(getent passwd 1000 | cut -d: -f1) + + if [ -z "$_CONTAINER_USER_HOME" ]; then + if [ -z "$CURRENT_USER" ]; then + _CONTAINER_USER_HOME=/root + else + _CONTAINER_USER_HOME=$(getent passwd $CURRENT_USER | cut -d: -f6) + fi + fi + + if [[ -z $CURRENT_USER ]]; then + echo 'eval "$(github-copilot-cli alias -- "$0")"' >> $_CONTAINER_USER_HOME/$RC_PROFILE + else + CMD="echo 'eval \"\$(github-copilot-cli alias -- \"\$0\")\"' >> \$_CONTAINER_USER_HOME/$RC_PROFILE" + su -c "$CMD" $CURRENT_USER + fi +fi + +echo 'Done!' \ No newline at end of file