cmdGlobalShow displays the current Host * configuration
(ctx *ShellContext)
| 637 | |
| 638 | // cmdGlobalShow displays the current Host * configuration |
| 639 | func cmdGlobalShow(ctx *ShellContext) error { |
| 640 | cfg, found, err := sshconfig.LoadGlobalConfig() |
| 641 | if err != nil { |
| 642 | return fmt.Errorf("failed to load global config: %w", err) |
| 643 | } |
| 644 | |
| 645 | if !found { |
| 646 | fmt.Println("\nNo Host * block found in ~/.ssh/config") |
| 647 | fmt.Println("\nYou can create one with: global edit") |
| 648 | return nil |
| 649 | } |
| 650 | |
| 651 | // Display all configured options |
| 652 | fmt.Println("\n=== Global SSH Configuration (Host *) ===") |
| 653 | fmt.Println() |
| 654 | |
| 655 | displayed := false |
| 656 | if cfg.ServerAliveInterval != "" { |
| 657 | fmt.Printf(" ServerAliveInterval: %s\n", cfg.ServerAliveInterval) |
| 658 | displayed = true |
| 659 | } |
| 660 | if cfg.ServerAliveCountMax != "" { |
| 661 | fmt.Printf(" ServerAliveCountMax: %s\n", cfg.ServerAliveCountMax) |
| 662 | displayed = true |
| 663 | } |
| 664 | if cfg.ForwardAgent != "" { |
| 665 | fmt.Printf(" ForwardAgent: %s\n", cfg.ForwardAgent) |
| 666 | displayed = true |
| 667 | } |
| 668 | if cfg.IdentityAgent != "" { |
| 669 | fmt.Printf(" IdentityAgent: %s\n", cfg.IdentityAgent) |
| 670 | displayed = true |
| 671 | } |
| 672 | if cfg.AddKeysToAgent != "" { |
| 673 | fmt.Printf(" AddKeysToAgent: %s\n", cfg.AddKeysToAgent) |
| 674 | displayed = true |
| 675 | } |
| 676 | if cfg.UseKeychain != "" { |
| 677 | fmt.Printf(" UseKeychain: %s\n", cfg.UseKeychain) |
| 678 | displayed = true |
| 679 | } |
| 680 | if cfg.PubkeyAcceptedAlgorithms != "" { |
| 681 | fmt.Printf(" PubkeyAcceptedAlgorithms: %s\n", cfg.PubkeyAcceptedAlgorithms) |
| 682 | displayed = true |
| 683 | } |
| 684 | if cfg.StrictHostKeyChecking != "" { |
| 685 | fmt.Printf(" StrictHostKeyChecking: %s\n", cfg.StrictHostKeyChecking) |
| 686 | displayed = true |
| 687 | } |
| 688 | if cfg.UserKnownHostsFile != "" { |
| 689 | fmt.Printf(" UserKnownHostsFile: %s\n", cfg.UserKnownHostsFile) |
| 690 | displayed = true |
| 691 | } |
| 692 | if cfg.Compression != "" { |
| 693 | fmt.Printf(" Compression: %s\n", cfg.Compression) |
| 694 | displayed = true |
| 695 | } |
| 696 | if cfg.TCPKeepAlive != "" { |
no test coverage detected