6 Commits

Author SHA1 Message Date
grzlus ed5eca8924 Fix 5 pre-release bugs
- Help text showed wrong config path (~/.portainer-cli vs ~/.config/portainer-cli)
- --port without colon (e.g. --port 8080) crashed with nil/tcp key; now errors clearly
- --cmd used naive split(' ') breaking quoted args; switched to Shellwords.split
- --env without '=' (e.g. --env FOO) silently passed empty value; now errors clearly
- SSL/connection errors surfaced as raw exception; now caught with actionable message

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 15:35:28 +01:00
grzlus 8e45e826ff Add --run flag to console command for running a specific command
--run CMD wraps the command in the shell: /bin/sh -c CMD, keeping TTY
mode so interactive commands like 'rails c' or 'bash' work correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 14:09:33 +01:00
grzlus 382ba15f15 Make container name optional in console command
When omitted, tries: 1) same name as stack, 2) 'app'.
So 'portainer-cli console librarian' resolves to librarian-librarian-1,
and 'portainer-cli console myapp' falls back to myapp-app-1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 14:06:56 +01:00
grzlus 9fe6ef339a Add --debug flag for WebSocket connection diagnostics
Shows WS URL, auth headers (truncated), full handshake request/response.
Also improves the handshake failure error to include the raw server response.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 13:09:01 +01:00
grzlus d8e00a4f1a Add console command with automatic endpoint resolution
portainer-cli console <stack> <container> looks up the stack by name to
find its endpoint ID automatically, so the user never needs to specify it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 13:01:41 +01:00
grzlus d3cb4fdebd Initial implementation of portainer-cli
Ruby CLI tool for interacting with the Portainer API. Supports listing
endpoints/stacks/containers/volumes/networks, creating stacks and containers,
and opening an interactive exec session in a container via WebSocket.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-22 12:58:33 +01:00