cli

command module
v0.0.0-...-3baaf17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

DevDB CLI

Command-line interface for managing development databases.

Installation

go install github.com/meido-ai/devdb/cli@latest

Usage

Managing Projects
# Create a new project
devdb project create myproject --type postgres --version 15

# List all projects
devdb project list

# View project details
devdb project show myproject

# Delete a project
devdb project delete myproject
Managing Databases
# Create a database in a project
devdb db create mydb --project myproject

# List databases in a project
devdb db list --project myproject

# View database details
devdb db show mydb --project myproject

# Delete a database
devdb db delete mydb --project myproject

Development

The CLI is built using Go and follows an OpenAPI-first approach. The API client code is automatically generated from the OpenAPI specification.

Prerequisites
Building
# Install the OpenAPI code generator
go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest

# Generate API client code, build the CLI, and run tests
make build
OpenAPI Integration

The CLI uses oapi-codegen to generate type-safe client code from the OpenAPI specification in ../api/openapi/openapi.yaml. This ensures:

  1. Type safety for API requests/responses
  2. Automatic client code generation
  3. Consistency with the API server

To update the generated client code:

# Generate client code only
make generate
Testing

The CLI includes comprehensive tests for all commands. Tests use a mock HTTP server to simulate API responses.

# Run all tests
make test

# Run tests with verbose output
go test ./cmd/... -v

# Run specific test
go test ./cmd/... -run TestDatabaseCommands

Project Structure

.
├── cmd/              # CLI commands
├── pkg/              # Shared packages
│   ├── api/         # Generated API client
│   └── config/      # Configuration
└── Makefile         # Build commands

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
api
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL