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>
This commit is contained in:
@@ -8,6 +8,7 @@ require_relative 'portainer_cli/commands/configure'
|
||||
require_relative 'portainer_cli/commands/list'
|
||||
require_relative 'portainer_cli/commands/create'
|
||||
require_relative 'portainer_cli/commands/exec'
|
||||
require_relative 'portainer_cli/commands/console'
|
||||
|
||||
module PortainerCli
|
||||
module CLI
|
||||
@@ -29,7 +30,9 @@ module PortainerCli
|
||||
portainer-cli list networks <endpoint-id> List networks
|
||||
portainer-cli create stack --endpoint ID --name NAME --file FILE
|
||||
portainer-cli create container --endpoint ID --image IMAGE [--name NAME] [--port h:c] [--env K=V]
|
||||
portainer-cli exec <endpoint-id> <container> Open interactive shell
|
||||
portainer-cli console <stack> <container> Open interactive shell (resolves endpoint automatically)
|
||||
--shell SHELL Shell to use (default: /bin/sh)
|
||||
portainer-cli exec <endpoint-id> <container> Open interactive shell (manual endpoint)
|
||||
--shell SHELL Shell to use (default: /bin/sh)
|
||||
|
||||
Config file: ~/.portainer-cli/config.yml
|
||||
@@ -50,7 +53,11 @@ module PortainerCli
|
||||
require_config!(config)
|
||||
client = Client.new(config)
|
||||
Commands::Create.new(config, client).run(argv)
|
||||
when 'exec', 'shell', 'console'
|
||||
when 'console'
|
||||
require_config!(config)
|
||||
client = Client.new(config)
|
||||
Commands::Console.new(config, client).run(argv)
|
||||
when 'exec', 'shell'
|
||||
require_config!(config)
|
||||
client = Client.new(config)
|
||||
Commands::Exec.new(config, client).run(argv)
|
||||
|
||||
Reference in New Issue
Block a user