diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3811c5c9c..076684e0d 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -51,6 +51,7 @@ Completions - ``apkanalyzer`` - ``scrypt`` - ``fastboot`` + - ``ssh-copy-id`` - git's completion for ``git-foo``-style commands was fixed (:issue:`9457`) - File completion now offers ``../`` and ``./`` again (:issue:`9477`) diff --git a/share/completions/ssh-copy-id.fish b/share/completions/ssh-copy-id.fish new file mode 100644 index 000000000..ca8c6984a --- /dev/null +++ b/share/completions/ssh-copy-id.fish @@ -0,0 +1,108 @@ +# Commands +complete -c ssh-copy-id -d Remote -xa "(__fish_complete_user_at_hosts)" +complete -c ssh-copy-id -d Remote -k -fa '(__ssh_history_completions)' + +# Options +complete -c ssh-copy-id -s i -d IdentityFile -r -F +complete -c ssh-copy-id -s p -d Port -r -x +complete -c ssh-copy-id -s F -d 'Alternate ssh config file' -r -F + +# Load completions shared by various ssh tools like ssh, scp and sftp. +complete -c ssh-copy-id -s o -d Options -xa " + AddKeysToAgent + AddressFamily + BatchMode + BindAddress + BindInterface + CanonicalDomains + CanonicalizeFallbackLocal + CanonicalizeHostname + CanonicalizeMaxDots + CanonicalizePermittedCNAMEs + CASignatureAlgorithms + CertificateFile + ChallengeResponseAuthentication + CheckHostIP + Ciphers + ClearAllForwardings + Compression + ConnectionAttempts + ConnectTimeout + ControlMaster + ControlPath + ControlPersist + DynamicForward + EscapeChar + ExitOnForwardFailure + FingerprintHash + ForwardAgent + ForwardX11 + ForwardX11Timeout + ForwardX11Trusted + GatewayPorts + GlobalKnownHostsFile + GSSAPIAuthentication + GSSAPIClientIdentity + GSSAPIDelegateCredentials + GSSAPIKexAlgorithms + GSSAPIKeyExchange + GSSAPIRenewalForcesRekey + GSSAPIServerIdentity + GSSAPITrustDns + HashKnownHosts + Host + HostbasedAuthentication + HostbasedKeyTypes + HostKeyAlgorithms + HostKeyAlias + Hostname + IdentitiesOnly + IdentityAgent + IdentityFile + IPQoS + KbdInteractiveAuthentication + KbdInteractiveDevices + KexAlgorithms + LocalCommand + LocalForward + LogLevel + MACs + Match + NoHostAuthenticationForLocalhost + NumberOfPasswordPrompts + PasswordAuthentication + PermitLocalCommand + PKCS11Provider + Port + PreferredAuthentications + ProxyCommand + ProxyJump + ProxyUseFdpass + PubkeyAcceptedKeyTypes + PubkeyAuthentication + RekeyLimit + RemoteCommand + RemoteForward + RequestTTY + SendEnv + ServerAliveCountMax + ServerAliveInterval + SetEnv + StreamLocalBindMask + StreamLocalBindUnlink + StrictHostKeyChecking + TCPKeepAlive + Tunnel + TunnelDevice + UpdateHostKeys + User + UserKnownHostsFile + VerifyHostKeyDNS + VisualHostKey + XAuthLocation + " + +complete -c ssh-copy-id -s f -d 'Force mode' +complete -c ssh-copy-id -s n -d 'Dry run' +complete -c ssh-copy-id -s s -d 'Use sftp' +complete -c ssh-copy-id -s h -s \? -d 'Show help' diff --git a/share/completions/ssh.fish b/share/completions/ssh.fish index f86317e8b..0e1083610 100644 --- a/share/completions/ssh.fish +++ b/share/completions/ssh.fish @@ -5,11 +5,6 @@ __fish_complete_ssh ssh # ssh specific completions # -# Also retrieve `user@host` entries from history -function __ssh_history_completions - history --prefix ssh --max=100 | string replace -rf '.* ([A-Za-z0-9._:-]+@[A-Za-z0-9._:-]+).*' '$1' -end - complete -c ssh -d Remote -xa "(__fish_complete_user_at_hosts)" complete -c ssh -d Remote -k -fa '(__ssh_history_completions)' diff --git a/share/functions/__ssh_history_completions.fish b/share/functions/__ssh_history_completions.fish new file mode 100644 index 000000000..d5b05019c --- /dev/null +++ b/share/functions/__ssh_history_completions.fish @@ -0,0 +1,3 @@ +function __ssh_history_completions -d "Retrieve `user@host` entries from history" + history --prefix ssh --max=100 | string replace -rf '.* ([A-Za-z0-9._:-]+@[A-Za-z0-9._:-]+).*' '$1' +end