Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add canonically-cased config options #1

Merged
merged 1 commit into from
Feb 11, 2022

Conversation

StephenBrown2
Copy link

@StephenBrown2 StephenBrown2 commented Feb 10, 2022

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 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, though printing still lowercases the keys.

NOTE: An identical PR has also been made upstream: kevinburke#39 so this can be closed if that one is merged in first.

StephenBrown2 pushed a commit to StephenBrown2/manssh that referenced this pull request Feb 10, 2022
TODO: Remove reference to github.com/StephenBrown2/ssh_config when kevinburke/ssh_config#39 or xwjdsh/ssh_config#1 get merged
@xwjdsh xwjdsh merged commit 3d04628 into xwjdsh:master Feb 11, 2022
@xwjdsh
Copy link
Owner

xwjdsh commented Feb 11, 2022

Thanks.

@xwjdsh
Copy link
Owner

xwjdsh commented Feb 11, 2022

I made a little polish on the basis of your changes.
936c636

@StephenBrown2
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants