ssh_config icon indicating copy to clipboard operation
ssh_config copied to clipboard

Add canonically-cased config options

Open StephenBrown2 opened this issue 3 years ago • 1 comments

This PR adds a list of config options pulled from https://man.openbsd.org/ssh_config (an example function to re-pull the list is included as well, commented out), and adds a KV.CanonicalKey() function, such that when printed with String(), the proper case is used for the Key, rather than all lowercase.

Example:

Host ssh.github.com gist.github.com github.com github
    Hostname ssh.github.com
    IdentitiesOnly yes
    IdentityFile ~/.ssh/id_ed25519
    User git

Without this, when manssh l prints:

        gist.github.com -> [email protected]:22
            identitiesonly = yes
            identityfile = ~/.ssh/id_ed25519

        github -> [email protected]:22
            identitiesonly = yes
            identityfile = ~/.ssh/id_ed25519

        github.com -> [email protected]:22
            identitiesonly = yes
            identityfile = ~/.ssh/id_ed25519

        github.me -> [email protected]:22
            identitiesonly = yes
            identityfile = ~/.ssh/id_ed25519

        ssh.github.com -> [email protected]:22
            identitiesonly = yes
            identityfile = ~/.ssh/id_ed25519

the ~/.ssh/config file is also modified:

Host ssh.github.com gist.github.com github.com github
    hostname ssh.github.com
    identitiesonly yes
    identityfile ~/.ssh/id_ed25519
    user git

With this change, the case is preserved in the file.

StephenBrown2 avatar Feb 10 '22 19:02 StephenBrown2

Thanks for this. Can I ask how you found this library? Or what underlying use case you ran into?

kevinburke avatar Mar 31 '22 19:03 kevinburke