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>
This commit is contained in:
2026-03-22 13:09:01 +01:00
parent c59deca51e
commit 9fe6ef339a
4 changed files with 26 additions and 8 deletions
+3 -2
View File
@@ -39,6 +39,7 @@ module PortainerCli
HELP
def self.run(argv)
debug = argv.delete('--debug')
config = Config.load
cmd = argv.shift&.downcase
@@ -56,11 +57,11 @@ module PortainerCli
when 'console'
require_config!(config)
client = Client.new(config)
Commands::Console.new(config, client).run(argv)
Commands::Console.new(config, client, debug: debug).run(argv)
when 'exec', 'shell'
require_config!(config)
client = Client.new(config)
Commands::Exec.new(config, client).run(argv)
Commands::Exec.new(config, client, debug: debug).run(argv)
when 'version', '--version', '-v'
puts "portainer-cli #{PortainerCli::VERSION}"
when 'help', '--help', '-h', nil