Skip to content

Commit

Permalink
Revert "chore: Remove Alpine GitHub Copilot CLI feature"
Browse files Browse the repository at this point in the history
This reverts commit 5b1491c.
  • Loading branch information
cirolosapio committed May 7, 2024
1 parent 7019184 commit b2534f0
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/alpine-gh-copilot-cli/README.md
Original file line number Diff line number Diff line change
@@ -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`._
20 changes: 20 additions & 0 deletions src/alpine-gh-copilot-cli/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
}
35 changes: 35 additions & 0 deletions src/alpine-gh-copilot-cli/install.sh
Original file line number Diff line number Diff line change
@@ -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!'

0 comments on commit b2534f0

Please sign in to comment.