55
66 "github.com/rsteube/carapace"
77 "github.com/rsteube/carapace-bin/pkg/actions/net"
8+ "github.com/rsteube/carapace-bin/pkg/actions/net/ssh"
89 "github.com/spf13/cobra"
910)
1011
@@ -70,7 +71,7 @@ func init() {
7071 // "B"
7172 // "b"
7273 "c" : carapace .ActionMultiParts ("," , func (c carapace.Context ) carapace.Action {
73- return ActionCiphers ().Invoke (c ).Filter (c .Parts ).ToA ()
74+ return ssh . ActionCiphers ().Invoke (c ).Filter (c .Parts ).ToA ()
7475 }),
7576 // "D"
7677 "E" : carapace .ActionFiles (),
@@ -88,7 +89,7 @@ func init() {
8889 "exit" , "request the master to exit" ,
8990 "stop" , "request the master to stop accepting further multiplexing requests" ,
9091 ),
91- "o" : ActionOptions (),
92+ "o" : ssh . ActionOptions (),
9293 // "p"
9394 "Q" : ActionQueryOptions (),
9495 // "R"
@@ -109,119 +110,6 @@ func init() {
109110 )
110111}
111112
112- func ActionCiphers () carapace.Action {
113- return carapace .ActionValues (
114- "3des-cbc" , "aes128-cbc" , "aes192-cbc" , "aes256-cbc" , "aes128-ctr" , "aes192-ctr" , "aes256-ctr" , "arcfour128" , "arcfour256" , "arcfour" , "blowfish-cbc" , "cast128-cbc" ,
115- )
116- }
117-
118- func ActionOptions () carapace.Action {
119- return carapace .ActionMultiParts ("=" , func (c carapace.Context ) carapace.Action {
120- options := map [string ]carapace.Action {
121- "AddKeysToAgent" : carapace .ActionValues (),
122- "AddressFamily" : carapace .ActionValues ("any" , "inet" , "inet6" ),
123- "BatchMode" : carapace .ActionValues ("yes" , "no" ),
124- "BindAddress" : carapace .ActionValues ("yes" , "no" ),
125- "CanonicalDomains" : carapace .ActionValues (),
126- "CanonicalizeFallbackLocal" : carapace .ActionValues (),
127- "CanonicalizeHostname" : carapace .ActionValues (),
128- "CanonicalizeMaxDots" : carapace .ActionValues (),
129- "CanonicalizePermittedCNAMEs" : carapace .ActionValues (),
130- "CASignatureAlgorithms" : carapace .ActionValues (),
131- "CertificateFile" : carapace .ActionValues (),
132- "ChallengeResponseAuthentication" : carapace .ActionValues ("yes" , "no" ),
133- "CheckHostIP" : carapace .ActionValues ("yes" , "no" ),
134- "Ciphers" : carapace .ActionValues (),
135- "ClearAllForwardings" : carapace .ActionValues (),
136- "Compression" : carapace .ActionValues ("yes" , "no" ),
137- "ConnectionAttempts" : carapace .ActionValues (),
138- "ConnectTimeout" : carapace .ActionValues (),
139- "ControlMaster" : carapace .ActionValues (),
140- "ControlPath" : carapace .ActionValues (),
141- "ControlPersist" : carapace .ActionValues (),
142- "DynamicForward" : carapace .ActionValues (),
143- "EscapeChar" : carapace .ActionValues (),
144- "ExitOnForwardFailure" : carapace .ActionValues ("yes" , "no" ),
145- "FingerprintHash" : carapace .ActionValues (),
146- "ForwardAgent" : carapace .ActionValues ("yes" , "no" ),
147- "ForwardX11" : carapace .ActionValues ("yes" , "no" ),
148- "ForwardX11Timeout" : carapace .ActionValues (),
149- "ForwardX11Trusted" : carapace .ActionValues ("yes" , "no" ),
150- "GatewayPorts" : carapace .ActionValues ("yes" , "no" ),
151- "GlobalKnownHostsFile" : carapace .ActionFiles (),
152- "GSSAPIAuthentication" : carapace .ActionValues ("yes" , "no" ),
153- "HashKnownHosts" : carapace .ActionValues ("yes" , "no" ),
154- "Host" : carapace .ActionValues (),
155- "HostbasedAuthentication" : carapace .ActionValues ("yes" , "no" ),
156- "HostbasedKeyTypes" : carapace .ActionValues (),
157- "HostKeyAlgorithms" : carapace .ActionValues (),
158- "HostKeyAlias" : carapace .ActionValues (),
159- "Hostname" : carapace .ActionValues (),
160- "IdentitiesOnly" : carapace .ActionValues ("yes" , "no" ),
161- "IdentityAgent" : carapace .ActionValues (),
162- "IdentityFile" : carapace .ActionFiles (),
163- "IPQoS" : carapace .ActionValues (),
164- "KbdInteractiveAuthentication" : carapace .ActionValues (),
165- "KbdInteractiveDevices" : carapace .ActionValues (),
166- "KexAlgorithms" : carapace .ActionValues (),
167- "LocalCommand" : carapace .ActionValues (),
168- "LocalForward" : carapace .ActionValues (),
169- "LogLevel" : carapace .ActionValues ("QUIET" , "FATAL" , "ERROR" , "INFO" , "VERBOSE" , "DEBUG" , "DEBUG1" , "DEBUG2" , "DEBUG3" ),
170- "MACs" : carapace .ActionValues (),
171- "Match" : carapace .ActionValues (),
172- "NoHostAuthenticationForLocalhost" : carapace .ActionValues (),
173- "NumberOfPasswordPrompts" : carapace .ActionValues (),
174- "PasswordAuthentication" : carapace .ActionValues (),
175- "PermitLocalCommand" : carapace .ActionValues (),
176- "PKCS11Provider" : carapace .ActionValues (),
177- "Port" : carapace .ActionValues (),
178- "PreferredAuthentications" : carapace .ActionValues (),
179- "ProxyCommand" : carapace .ActionValues (),
180- "ProxyJump" : carapace .ActionValues (),
181- "ProxyUseFdpass" : carapace .ActionValues (),
182- "PubkeyAcceptedKeyTypes" : carapace .ActionValues (),
183- "PubkeyAuthentication" : carapace .ActionValues (),
184- "RekeyLimit" : carapace .ActionValues (),
185- "RemoteCommand" : carapace .ActionValues (),
186- "RemoteForward" : carapace .ActionValues (),
187- "RequestTTY" : carapace .ActionValues (),
188- "SendEnv" : carapace .ActionValues (),
189- "ServerAliveInterval" : carapace .ActionValues (),
190- "ServerAliveCountMax" : carapace .ActionValues (),
191- "SetEnv" : carapace .ActionValues (),
192- "StreamLocalBindMask" : carapace .ActionValues (),
193- "StreamLocalBindUnlink" : carapace .ActionValues (),
194- "StrictHostKeyChecking" : carapace .ActionValues ("yes" , "no" , "ask" ),
195- "TCPKeepAlive" : carapace .ActionValues ("yes" , "no" ),
196- "Tunnel" : carapace .ActionValues ("yes" , "point-to-point" , "ethernet" , "no" ),
197- "TunnelDevice" : carapace .ActionValues (),
198- "UpdateHostKeys" : carapace .ActionValues (),
199- "User" : carapace .ActionValues (),
200- "UserKnownHostsFile" : carapace .ActionFiles (),
201- "VerifyHostKeyDNS" : carapace .ActionValues ("yes" , "no" , "ask" ),
202- "VisualHostKey" : carapace .ActionValues ("yes" , "no" ),
203- "XAuthLocation" : carapace .ActionFiles (),
204- }
205-
206- switch len (c .Parts ) {
207- case 0 :
208- keys := make ([]string , 0 , len (options ))
209- for key := range options {
210- keys = append (keys , key )
211- }
212- return carapace .ActionValues (keys ... ).Invoke (c ).Suffix ("=" ).ToA ()
213- case 1 :
214- if val , ok := options [c .Parts [0 ]]; ok {
215- return val
216- } else {
217- return carapace .ActionValues ()
218- }
219- default :
220- return carapace .ActionValues ()
221- }
222- })
223- }
224-
225113func ActionQueryOptions () carapace.Action {
226114 return carapace .ActionValuesDescribed (
227115 "cipher" , "supported symmetric ciphers" ,
0 commit comments