Skip to content

shell completion installs #133

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 1 commit into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ project_name: container-use
before:
hooks:
- go mod tidy
- ./scripts/completions.sh

builds:
- id: cu
Expand Down Expand Up @@ -34,6 +35,7 @@ archives:
files:
- README.md
- LICENSE
- completions/*

homebrew_casks:
- repository:
Expand All @@ -53,9 +55,14 @@ homebrew_casks:
template: "https://github.com/{{ .Env.GH_ORG_NAME }}/container-use/releases/download/{{ .Tag }}/{{ .ArtifactName }}"
homepage: "https://github.com/{{ .Env.GH_ORG_NAME }}/container-use"
description: "Containerized environments for coding agents"
completions:
bash: "completions/cu.bash"
zsh: "completions/cu.zsh"
fish: "completions/cu.fish"
hooks:
post:
install: |
# remove quarantine xattr (note we don't do anything with signatures yet)
if system_command("/usr/bin/xattr", args: ["-h"]).exit_status == 0
system_command "/usr/bin/xattr", args: ["-dr", "com.apple.quarantine", "#{staged_path}/cu"]
end
Expand Down
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,21 @@ It's an open-source MCP server that works as a CLI tool with Claude Code, Cursor

## Install

### macOS (Homebrew - Recommended)
### Homebrew (Recommended for MacOS)

```sh
brew install dagger/tap/container-use
```

(Optional) Install shell completions:

```sh
cu completion bash > $(brew --prefix)/etc/bash_completion.d/container-use
```
Our tap should install shell completions for you.

### All Platforms (Shell Script)

```sh
curl -fsSL https://raw.githubusercontent.com/dagger/container-use/main/install.sh | bash
```

This will check for Docker & Git (required), detect your platform, and install the latest `cu` binary to your `$PATH`.

(Optional) Install shell completions:

```sh
cu completion bash > /etc/bash_completion.d/container-use
```
This will check for Docker & Git (required), detect your platform, install the latest `cu` binary to your `$PATH`, and provide completion installation instructions.

For building from source, see [CONTRIBUTING.md](CONTRIBUTING.md#building).

Expand Down
15 changes: 15 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ get_latest_version() {
curl -s "https://api.github.com/repos/$REPO/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
}

# Show shell completion setup instructions
show_completion_instructions() {
local binary="$1"

log_info "To enable shell completions, run:"
echo " Bash (with bash-completion): $binary completion bash > ~/.local/share/bash-completion/completions/cu"
echo " Bash (unconfigured): echo 'source <($binary completion bash)' >> ~/.bashrc"
echo " Zsh (with compinit and a writable fpath[1]): $binary completion zsh > \"\${fpath[1]}/_cu\""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docker adds in zshrc, an fpath as the first entry. But i don't want to add cu's completion to my docker's completion folder.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 under some package managers fpath[1] isn't gonna be user-writable either, so unideal in several situations.

can i get a citation for the docker approach?

echo " Zsh (unconfigured): echo 'source <($binary completion bash)' >> ~/.zshrc"
echo " Fish: $binary completion fish > ~/.config/fish/completions/cu.fish"
}

# Verify checksum of downloaded file
verify_checksum() {
local archive_file="$1"
Expand Down Expand Up @@ -281,6 +293,9 @@ main() {
if [ -x "$INSTALL_DIR/$BINARY_NAME" ]; then
log_success "Installation complete!"

# Show shell completion instructions
show_completion_instructions "$BINARY_NAME"

# Check if the correct cu command is being found in PATH
local found_binary=$(command -v "$BINARY_NAME" 2>/dev/null || echo "")

Expand Down
7 changes: 7 additions & 0 deletions scripts/completions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
set -e
rm -rf completions
mkdir completions
for sh in bash zsh fish; do
go run ./cmd/cu completion "$sh" >"completions/cu.$sh"
done