Skip to content
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
66 changes: 58 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,72 @@ Profiles are stored in:
- **Linux/macOS**: `~/.config/redisctl/config.toml`
- **Windows**: `%APPDATA%\redis\redisctl\config.toml`

### 2. Basic Commands
Example configuration file:
```toml
default_profile = "cloud-prod"

[profiles.cloud-prod]
deployment_type = "cloud"
api_key = "${REDIS_CLOUD_API_KEY}"
api_secret = "${REDIS_CLOUD_API_SECRET}"

[profiles.enterprise-dev]
deployment_type = "enterprise"
url = "https://localhost:9443"
username = "admin@redis.local"
password = "${REDIS_ENTERPRISE_PASSWORD}"
insecure = true
```

### 2. Verify Setup & First Commands

```bash
# List databases (auto-detects deployment type from profile)
redisctl database list
# Test your connection
redisctl api cloud get / # For Cloud
redisctl api enterprise get /v1/cluster # For Enterprise

# View your configuration
redisctl profile list # Show all profiles
redisctl profile path # Show config file location

# Common first commands
redisctl database list # List all databases
redisctl cloud subscription list # List Cloud subscriptions
redisctl enterprise node list # List Enterprise nodes

# Get database details with formatted output
redisctl database get 12345 --output table
# Get detailed output
redisctl database get 12345 --output table # Table format
redisctl database list -o json | jq # JSON with jq

# Create a database and wait for completion
# Create resources and wait for completion
redisctl cloud database create --data @database.json --wait
```

## Using with Docker

# Direct API access for any endpoint
redisctl api cloud get /subscriptions/88449/databases
```bash
# Run commands directly with Docker
docker run --rm \
-e REDIS_CLOUD_API_KEY \
-e REDIS_CLOUD_API_SECRET \
ghcr.io/joshrotenberg/redisctl:latest \
cloud subscription list

# Use local config file
docker run --rm \
-v ~/.config/redisctl:/root/.config/redisctl:ro \
ghcr.io/joshrotenberg/redisctl:latest \
database list

# Development environment with test cluster
make docker-up # Start Redis Enterprise cluster
make docker-cli # Interactive CLI session
make docker-test # Run test suite
make docker-down # Clean up
```

See the [Docker documentation](https://joshrotenberg.com/redisctl/getting-started/docker.html) for advanced usage.

## Documentation

For comprehensive documentation including:
Expand Down
4 changes: 4 additions & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- [Installation](./getting-started/installation.md)
- [Configuration](./getting-started/configuration.md)
- [Quick Start](./getting-started/quickstart.md)
- [Authentication](./getting-started/authentication.md)
- [Shell Completions](./getting-started/shell-completions.md)
- [Docker Development](./getting-started/docker.md)

# Redis Cloud Commands

Expand Down Expand Up @@ -42,6 +45,7 @@

# Tutorials

- [Common Recipes](./tutorials/common-recipes.md)
- [Managing Production Databases](./tutorials/production-databases.md)
- [Setting Up Monitoring](./tutorials/monitoring.md)
- [Disaster Recovery](./tutorials/disaster-recovery.md)
Expand Down
192 changes: 192 additions & 0 deletions docs/src/getting-started/shell-completions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
# Shell Completions

redisctl supports tab completion for all major shells. This guide shows how to install and configure completions for your shell.

## Generating Completions

First, generate the completion script for your shell:

```bash
# Bash
redisctl completions bash > redisctl.bash

# Zsh
redisctl completions zsh > _redisctl

# Fish
redisctl completions fish > redisctl.fish

# PowerShell
redisctl completions powershell > redisctl.ps1

# Elvish
redisctl completions elvish > redisctl.elv
```

## Installing Completions

### Bash

```bash
# Linux - User-specific
redisctl completions bash > ~/.local/share/bash-completion/completions/redisctl

# Linux - System-wide (requires sudo)
sudo redisctl completions bash > /usr/share/bash-completion/completions/redisctl

# macOS with Homebrew
redisctl completions bash > $(brew --prefix)/etc/bash_completion.d/redisctl

# Reload your shell
source ~/.bashrc
# or start a new terminal
```

### Zsh

```bash
# Add to your fpath (usually in ~/.zshrc)
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc

# Create directory if needed
mkdir -p ~/.zsh/completions

# Generate completion file
redisctl completions zsh > ~/.zsh/completions/_redisctl

# Reload your shell
source ~/.zshrc
# or start a new terminal
```

### Fish

```bash
# Generate completion file
redisctl completions fish > ~/.config/fish/completions/redisctl.fish

# Completions are loaded automatically in new shells
# or reload current shell:
source ~/.config/fish/config.fish
```

### PowerShell

```powershell
# Add to your PowerShell profile
redisctl completions powershell >> $PROFILE

# Or save to a file and source it
redisctl completions powershell > redisctl.ps1
Add-Content $PROFILE ". $PWD\redisctl.ps1"

# Reload profile
. $PROFILE
```

### Elvish

```bash
# Generate completion file
redisctl completions elvish > ~/.elvish/lib/redisctl.elv

# Add to rc.elv
echo "use redisctl" >> ~/.elvish/rc.elv

# Reload shell
exec elvish
```

## Testing Completions

After installation, test that completions work:

```bash
# Type and press Tab
redisctl <Tab>
# Should show: api, auth, cloud, enterprise, profile, etc.

# Try sub-commands
redisctl cloud <Tab>
# Should show: database, subscription, user, etc.

# Try options
redisctl --<Tab>
# Should show: --help, --version, --profile, --output, etc.
```

## Troubleshooting

### Completions Not Working

1. **Check shell configuration:**
```bash
# Bash - verify completion is enabled
echo $BASH_COMPLETION_COMPAT_DIR

# Zsh - check fpath
echo $fpath

# Fish - check completion directory
ls ~/.config/fish/completions/
```

2. **Reload your shell:**
```bash
# Option 1: Source config file
source ~/.bashrc # or ~/.zshrc, etc.

# Option 2: Start new shell
exec $SHELL

# Option 3: Open new terminal
```

3. **Verify file permissions:**
```bash
# Check completion file exists and is readable
ls -la ~/.local/share/bash-completion/completions/redisctl
# or your shell's completion directory
```

### Updating Completions

When updating redisctl, regenerate completions to get new commands:

```bash
# Example for Bash
redisctl completions bash > ~/.local/share/bash-completion/completions/redisctl
source ~/.bashrc
```

### Custom Completion Directories

If using non-standard directories:

```bash
# Bash - add to .bashrc
source /path/to/redisctl.bash

# Zsh - add to .zshrc
fpath=(/path/to/completions $fpath)
autoload -U compinit && compinit

# Fish - add to config.fish
source /path/to/redisctl.fish
```

## Tips

- **Auto-update completions:** Add completion generation to your dotfiles setup
- **Multiple shells:** Generate completions for all shells you use
- **Container usage:** Mount completion files when using Docker:
```bash
docker run -v ~/.local/share/bash-completion:/etc/bash_completion.d:ro ...
```
- **CI/CD:** Include completion generation in your deployment scripts

## See Also

- [Installation Guide](installation.md) - Installing redisctl
- [Configuration](configuration.md) - Setting up profiles
- [Quick Start](quickstart.md) - Getting started with redisctl
Loading
Loading