A lightweight, environment-aware HTTP CLI tool built with Go. Make HTTP requests from the command line with support for saved calls, templated paths, environment variables, and workspace-specific configurations.
- Simple HTTP Requests: GET, POST, PUT, DELETE, PATCH with easy syntax
- Saved Calls: Save and recall frequently used requests with
--saveandgosh recall - Path Templating: Support for templated paths with
{variable}syntax and interactive prompts - Environment Variables: Substitute environment variables with
${VAR_NAME}syntax - Workspace Aware: Automatic detection of workspace roots and per-workspace configurations
- Configuration Files:
.gosh.yamlfor workspace-specific defaults.envfor environment variables$XDG_CONFIG_HOME/gosh/config.yamlfor global settings
- Response Formatting: Pretty-print JSON responses with automatic content-type detection
- Pipe Support: Read request bodies from stdin
- TTY-Aware Coloring: Automatic color output when connected to a terminal
- Authentication Presets: Save and reuse Bearer tokens, Basic auth, and custom authentication headers
git clone https://github.com/john-eevee/gosh.git
cd gosh
go build -o gosh ./cmd/gosh
sudo mv gosh /usr/local/bin/Download pre-built binaries for your platform from releases:
# macOS
curl -L https://github.com/john-eevee/gosh/releases/download/v0.1.1/gosh-macos-amd64 -o gosh
chmod +x gosh
sudo mv gosh /usr/local/bin/
# Linux
curl -L https://github.com/john-eevee/gosh/releases/download/v0.1.1/gosh-linux-amd64 -o gosh
chmod +x gosh
sudo mv gosh /usr/local/bin/
# Windows
# Download from https://github.com/john-eevee/gosh/releasesdocker pull ghcr.io/john-eevee/gosh:latest
docker run --rm ghcr.io/john-eevee/gosh:latest get https://api.example.combrew install john-eevee/gosh/gosh# Simple GET
gosh get https://api.example.com/users
# GET with headers
gosh get https://api.example.com/users -H Authorization:"Bearer token-123"
# POST with JSON body
gosh post https://api.example.com/users -d '{"name":"John","email":"john@example.com"}'
# Multiple headers
gosh post https://api.example.com/data \
-H Authorization:"Bearer xyz" \
-H Content-Type:"application/json" \
-d '{"key":"value"}'# URL with template variable - prompts for missing values
gosh get https://api.example.com/users/{userId}
# Provide template variable from CLI
gosh get https://api.example.com/users/{userId} userId=123
# Multiple template variables
gosh get https://api.example.com/users/{userId}/posts/{postId} userId=1 postId=42Create a .env file in your workspace:
API_TOKEN=my-secret-token
API_BASE=https://dev.example.comThen use in requests:
gosh get https://api.example.com/data -H Authorization:"Bearer ${API_TOKEN}"
gosh get ${API_BASE}/users# Save the request for later use
gosh post https://api.example.com/users \
-H Authorization:"Bearer token" \
-d '{"name":"John"}' \
--save create-user
# List all saved calls
gosh list
# Execute saved call
gosh recall create-user
# Execute saved call with parameter override
gosh recall create-user userId=456 -H Authorization:"Bearer different-token"
# Delete saved call
gosh delete create-user# Parse and save without executing
gosh post https://api.example.com/users \
-d '{"name":"John"}' \
--dry \
--save my-request# Show full response info (status, headers, body, timing, size)
gosh get https://api.example.com/users --info
# Regular output (just body)
gosh get https://api.example.com/users# Read body from stdin
cat user.json | gosh post https://api.example.com/users
# Pipe curl response
curl https://example.com/data | gosh post https://api.example.com/transformSave and reuse authentication credentials with the gosh auth command:
# Add a bearer token preset
gosh auth add bearer myapi token=my-secret-token-123
# Use it in requests
gosh get https://api.example.com/data --auth myapi
# List all presets
gosh auth list
# Remove a preset
gosh auth remove myapi# Add basic auth (username + password)
gosh auth add basic prod-api username=john password=secret123
# Use it in requests
gosh get https://api.example.com/protected --auth prod-api# Add custom header-based authentication
gosh auth add custom myapi header=X-API-Key value=secret-key-12345
# With prefix (e.g., "Token " prefix)
gosh auth add custom github-api header=Authorization value=ghp_token123 prefix="token "
# Use in requests
gosh get https://api.example.com/resources --auth myapi# Add a preset
gosh auth add <type> <name> [options]
type: basic, bearer, or custom
options depend on type:
basic: username=USER password=PASS
bearer: token=TOKEN
custom: header=HEADER value=VALUE [prefix=PREFIX]
# List all presets
gosh auth list
# Remove a preset
gosh auth remove <name>
# Use preset in request
gosh <METHOD> <URL> --auth <name>Create a .gosh.yaml file in your project root to set workspace defaults:
name: my-api-workspace
baseUrl: https://api.example.com
defaultHeaders:
User-Agent: "gosh/1.0"
Accept: "application/json"
environments:
dev:
API_TOKEN: "dev-token-123"
API_BASE: "https://dev.example.com"
prod:
API_TOKEN: "prod-token-456"
API_BASE: "https://api.example.com"Create a .env file for local environment variables:
API_TOKEN=my-token
API_BASE=https://api.example.com
TIMEOUT=30s
Create $XDG_CONFIG_HOME/gosh/config.yaml (or ~/.config/gosh/config.yaml):
defaultEnvironment: dev
prettyPrint: true
timeout: 30s
userAgent: "gosh/1.0"gosh <METHOD> <URL> [OPTIONS] [HEADERS] [BODY]
OPTIONS:
-H KEY:VALUE Add header (can be multiple)
-d DATA Request body
--save NAME Save request as NAME
--dry Parse without executing
--info Show full response info
--no-interactive Don't prompt for missing variables
--env ENVIRONMENT Use specific environment context
--format json|raw|text Output format
--auth PRESET Use authentication preset
TEMPLATE SYNTAX:
{varName} Path/URL variable (interactive prompt)
${ENV_VAR} Environment variable substitution
key=value Path parameter overridegosh recall <name> [OVERRIDES]
gosh list
gosh delete <name>gosh auth add <type> <name> [options]
gosh auth list
gosh auth remove <name># 1. Create a request
gosh post https://jsonplaceholder.typicode.com/posts \
-d '{"title":"My Post","body":"Hello World","userId":1}' \
--save new-post
# 2. View saved calls
gosh list
# 3. Execute saved call
gosh recall new-post
# 4. View details
gosh recall new-post --info# Set up workspace
cat > .gosh.yaml << EOF
name: my-api
defaultHeaders:
Authorization: "Bearer ${API_TOKEN}"
Accept: "application/json"
EOF
cat > .env << EOF
API_TOKEN=secret-token-123
API_BASE=https://api.example.com
EOF
# Use templated request
gosh get 'https://api.example.com/users/{userId}' userId=42
# With environment variable
gosh get https://api.example.com/posts -H Authorization:"Bearer ${API_TOKEN}"# Transform data through multiple requests
curl https://source.api.com/data | gosh post https://dest.api.com/import
# Use jq to format and pipe
echo '{"user":"john"}' | jq . | gosh post https://api.example.com/usersSaved calls are stored in the workspace root:
your-project/
├── .gosh.yaml # Workspace config
├── .env # Environment variables
└── .gosh/
└── calls/
├── create-user.yaml
├── list-posts.yaml
└── update-post.yaml
Workspace detection:
- Looks for
.gosh.yamlin current directory or parent directories - Falls back to git root (
.gitdirectory) - Uses current directory if no workspace marker found
Output is automatically colored when connected to a terminal:
- Green: 2xx status codes
- Blue: 3xx status codes
- Yellow: 4xx status codes
- Red: 5xx status codes
Disable colors by piping output: gosh get url | cat
0: Success1: Error (invalid arguments, network error, etc.)
git clone https://github.com/john-eevee/gosh.git
cd gosh
make build
# Binary is in bin/goshmake test # Run all tests
make coverage # Generate coverage report
make lint # Run linters
make all # Format, lint, test, and buildmake help # Show all available targets
make install # Install to $GOBIN
make fmt # Format code
make vet # Run go vet
make clean # Remove artifactsSee Makefile for more targets and options.
This project uses GitHub Actions for:
- Automated Testing: Runs on multiple platforms and Go versions
- Code Quality: Linting and formatting checks
- Security: Gosec vulnerability scanning and CodeQL analysis
- Coverage: Code coverage tracking with Codecov
- Releases: Automated multi-platform binary builds and Docker images
See CI_CD.md for detailed pipeline documentation.
Current limitations:
- Interactive prompts require TTY (use
--no-interactivefor piped input)
Future enhancements:
- Enhanced bubbletea UI for interactive mode
- Global saved calls and credentials management
- Response caching and history
- Session management and cookie handling
- OAuth2/OIDC authentication support
- WebSocket support
- GraphQL query builder
| Feature | gosh | HTTPie |
|---|---|---|
| Language | Go | Python |
| Single Binary | ✅ | ❌ |
| Workspace Config | ✅ | ❌ |
| Path Templating | ✅ | ❌ |
| Saved Calls | ✅ | ❌ |
| Environment Vars | ✅ | ✅ |
| Response Formatting | ✅ | ✅ |
| Pipe Support | ✅ | ✅ |
MIT - See LICENSE for details.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Please see CODE_OF_CONDUCT.md for our community standards.