Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.prism.log
dist/
/hypeman
.env
hypeman/**
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,35 @@ go run cmd/hypeman/main.go

## Usage

The CLI follows a resource-based command structure:

```sh
hypeman [resource] [command] [flags]
```
# Pull an image
hypeman pull nginx:alpine

```sh
hypeman health check
# Run an instance (auto-pulls image if needed)
hypeman run nginx:alpine
hypeman run --name my-app -e PORT=3000 nginx:alpine

# List running instances
hypeman ps
hypeman ps -a # show all instances

# View logs
hypeman logs <instance-id>
hypeman logs -f <instance-id> # follow logs

# Execute a command in a running instance
hypeman exec <instance-id> -- /bin/sh
hypeman exec -it <instance-id> # interactive shell
```

For details about specific commands, use the `--help` flag.

The CLI also provides resource-based commands for more advanced usage:

```sh
hypeman [resource] [command] [flags]
```

## Global Flags

- `--debug` - Enable debug logging (includes HTTP request/response details)
Expand Down
6 changes: 6 additions & 0 deletions cmd/hypeman/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ import (
func main() {
app := cmd.Command
if err := app.Run(context.Background(), os.Args); err != nil {
// Handle exec exit codes specially - exit with the command's exit code
var execErr *cmd.ExecExitError
if errors.As(err, &execErr) {
os.Exit(execErr.Code)
}

var apierr *hypeman.Error
if errors.As(err, &apierr) {
fmt.Fprintf(os.Stderr, "%s %q: %d %s\n", apierr.Request.Method, apierr.Request.URL, apierr.Response.StatusCode, http.StatusText(apierr.Response.StatusCode))
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ require (
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/gorilla/websocket v1.5.3 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/itchyny/json2yaml v0.1.4 h1:/pErVOXGG5iTyXHi/QKR4y3uzhLjGTEmmJIy97YT+k8=
github.com/itchyny/json2yaml v0.1.4/go.mod h1:6iudhBZdarpjLFRNj+clWLAkGft+9uCcjAZYXUH9eGI=
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
Expand Down
5 changes: 5 additions & 0 deletions pkg/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ func init() {
},
},
Commands: []*cli.Command{
&execCmd,
&pullCmd,
&runCmd,
&psCmd,
&logsCmd,
{
Name: "health",
Category: "API RESOURCE",
Expand Down
Loading