MCPcopy Create free account
hub / github.com/Mister-leo/fssh / cmdShow

Function cmdShow

cmd/fssh/shell_commands.go:420–469  ·  view source on GitHub ↗

cmdShow displays detailed host configuration

(ctx *ShellContext, args string)

Source from the content-addressed store, hash-verified

418
419// cmdShow displays detailed host configuration
420func cmdShow(ctx *ShellContext, args string) error {
421 hostName := strings.TrimSpace(args)
422 if hostName == "" {
423 fmt.Println("Usage: show <host>")
424 return nil
425 }
426
427 // Load configuration
428 cfg, err := sshconfig.LoadHostConfig(hostName)
429 if err != nil {
430 return fmt.Errorf("host not found: %w", err)
431 }
432
433 // Display configuration
434 fmt.Printf("\n=== Host: %s ===\n", cfg.Name)
435 fmt.Printf("Hostname: %s\n", cfg.Hostname)
436
437 if cfg.User != "" {
438 fmt.Printf("User: %s\n", cfg.User)
439 }
440 if cfg.Port != "" {
441 fmt.Printf("Port: %s\n", cfg.Port)
442 } else {
443 fmt.Printf("Port: 22 (default)\n")
444 }
445
446 if cfg.IdentityAgent != "" {
447 fmt.Printf("IdentityAgent: %s\n", cfg.IdentityAgent)
448 }
449 for _, idFile := range cfg.IdentityFile {
450 fmt.Printf("IdentityFile: %s\n", idFile)
451 }
452
453 if cfg.ProxyJump != "" {
454 fmt.Printf("ProxyJump: %s\n", cfg.ProxyJump)
455 }
456 if cfg.ProxyCommand != "" {
457 fmt.Printf("ProxyCommand: %s\n", cfg.ProxyCommand)
458 }
459
460 if cfg.ForwardAgent != "" {
461 fmt.Printf("ForwardAgent: %s\n", cfg.ForwardAgent)
462 }
463 if cfg.ServerAliveInterval != "" {
464 fmt.Printf("ServerAliveInterval: %s\n", cfg.ServerAliveInterval)
465 }
466
467 fmt.Println()
468 return nil
469}
470
471// cmdInfo displays detailed host configuration by ID, alias, hostname, or IP
472func cmdInfo(ctx *ShellContext, args string) error {

Callers 1

runShellFunction · 0.85

Calls 1

LoadHostConfigFunction · 0.92

Tested by

no test coverage detected