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 #39

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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 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 StephenBrown2 changed the title Add canonically-cased config optons Add canonically-cased config options Feb 10, 2022
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
@kevinburke
Copy link
Owner

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

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