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 completions for ssh-keygen #10508

Merged
merged 2 commits into from
May 24, 2024
Merged

Conversation

tesuji
Copy link
Contributor

@tesuji tesuji commented May 20, 2024

No description provided.

Copy link
Contributor

@mqudsi mqudsi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The completions fish generates automatically by parsing the manpages cover significantly more tokens. Adding this to fish would suppress those from being generated/used; I'm not sure this is a good change:

# ssh-keygen
# Autogenerated from man page /usr/share/man/man1/ssh-keygen.1.gz
complete -c ssh-keygen -s A -d 'Generate host keys of all default key types (rsa, ecdsa, and ed25519) if they…'
complete -c ssh-keygen -s a -d 'When saving a private key, this option specifies the number of KDF (key deriv…'
complete -c ssh-keygen -s B -d 'Show the bubblebabble digest of specified private or public key file'
complete -c ssh-keygen -s b -d 'Specifies the number of bits in the key to create'
complete -c ssh-keygen -s C -d 'Provides a new comment'
complete -c ssh-keygen -s c -d 'Requests changing the comment in the private and public key files'
complete -c ssh-keygen -s D -d 'Download the public keys provided by the PKCS#11 shared library pkcs11'
complete -c ssh-keygen -s E -d 'Specifies the hash algorithm used when displaying key fingerprints'
complete -c ssh-keygen -s e -d 'This option will read a private or public OpenSSH key file and print to stdou…'
complete -c ssh-keygen -s F -d 'Search for the specified hostname (with optional port number) in a known_host…'
complete -c ssh-keygen -s f -d 'Specifies the filename of the key file'
complete -c ssh-keygen -s g -d 'Use generic DNS format when printing fingerprint resource records using the r…'
complete -c ssh-keygen -s H -d 'Hash a known_hosts file'
complete -c ssh-keygen -s h -d 'When signing a key, create a host certificate instead of a user certificate'
complete -c ssh-keygen -s I -d 'Specify the key identity when signing a public key'
complete -c ssh-keygen -s i -d 'This option will read an unencrypted private (or public) key file in the form…'
complete -c ssh-keygen -s K -d 'Download resident keys from a FIDO authenticator'
complete -c ssh-keygen -s k -d 'Generate a KRL file'
complete -c ssh-keygen -s L -d 'Prints the contents of one or more certificates'
complete -c ssh-keygen -s l -d 'Show fingerprint of specified public key file'
complete -c ssh-keygen -s M -d 'Generate candidate Diffie-Hellman Group Exchange (DH-GEX) parameters for even…'
complete -c ssh-keygen -s m -d 'Specify a key format for key generation, the i (import), e (export) conversio…'
complete -c ssh-keygen -s N -d 'Provides the new passphrase'
complete -c ssh-keygen -s n -d 'Specify one or more principals (user or host names) to be included in a certi…'
complete -c ssh-keygen -s O -d 'Specify a key/value option'
complete -c ssh-keygen -s P -d 'Provides the (old) passphrase'
complete -c ssh-keygen -s p -d 'Requests changing the passphrase of a private key file instead of creating a …'
complete -c ssh-keygen -s Q -d 'Test whether keys have been revoked in a KRL'
complete -c ssh-keygen -s q -d 'Silence ssh-keygen ssh-keygen'
complete -c ssh-keygen -s R -d 'Removes all keys belonging to the specified hostname (with optional port numb…'
complete -c ssh-keygen -s r -d 'Print the SSHFP fingerprint resource record named hostname for the specified …'
complete -c ssh-keygen -s s -d 'Certify (sign) a public key using the specified CA key'
complete -c ssh-keygen -s t -d 'Specifies the type of key to create'
complete -c ssh-keygen -s U -d 'When used in combination with s or Y Cm sign, this option indicates that a CA…'
complete -c ssh-keygen -s u -d 'Update a KRL'
complete -c ssh-keygen -s V -d 'Specify a validity interval when signing a certificate'
complete -c ssh-keygen -s v -d 'Verbose mode'
complete -c ssh-keygen -s w -d 'Specifies a path to a library that will be used when creating FIDO authentica…'
complete -c ssh-keygen -s Y -d 'Find the principal(s) associated with the public key of a signature, provided…'
complete -c ssh-keygen -s y -d 'This option will read a private OpenSSH format file and print an OpenSSH publ…'
complete -c ssh-keygen -s Z -d 'Specifies the cipher to use for encryption when writing an OpenSSH-format pri…'
complete -c ssh-keygen -s z -d 'Specifies a serial number to be embedded in the certificate to distinguish th…'

@tesuji
Copy link
Contributor Author

tesuji commented May 23, 2024

For my simple use case, I just want to generate a new key with a specific suggested key type.
I could add more options parsed from ssh-keygen's manpage but I don't know
if many people demands such flags.

Currently the generated completion from manpage doesn't help with required arguments of ssh-keygen.

@github-actions github-actions bot added this to the fish next-3.x milestone May 23, 2024
@tesuji tesuji requested a review from mqudsi May 23, 2024 23:44
@tesuji tesuji changed the title add bare completions for ssh-keygen add completions for ssh-keygen May 23, 2024
@mqudsi mqudsi merged commit 57963ce into fish-shell:master May 24, 2024
7 of 8 checks passed
@mqudsi
Copy link
Contributor

mqudsi commented May 24, 2024

Thanks, this works great.

@tesuji tesuji deleted the completion-sshkeygen branch May 24, 2024 22:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants