1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-03 07:37:47 +00:00

Add ssh completion (#891)

Read ssh config from `/etc/ssh/ssh_config` and `~/.ssh/config`.

Given: 
![螢幕擷取畫面 2024-07-09
232722](https://github.com/nushell/nu_scripts/assets/5771562/9294efd7-42c0-4a6c-9dac-06a6a87f67c5)

Will show:

![螢幕擷取畫面 2024-07-09
232640](https://github.com/nushell/nu_scripts/assets/5771562/a8e3844b-ac91-417b-a973-c31366ae1460)
This commit is contained in:
denny 2024-07-10 21:26:11 +08:00 committed by GitHub
parent d6cf03e315
commit bfd2af7106
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 92 additions and 0 deletions

View file

@ -0,0 +1,40 @@
# SSH completions
A Nushell extern definition and completers for the ssh command.
This module provides extern definitions for most of the ssh command options and flags.
## Usage
Simply import the extern definitions with
```nu
source path/to/ssh-completions.nu
```
This script will parse `/etc/ssh/ssh_config` and `~/.ssh/config` to fetch SSH config hosts.
Given the following config:
```
Host my-ip
HostName 192.168.50.237
Host mydomain
HostName mydomain.example.com
Host my-domain-2
HostName mydomain-2.example.com
Host my_domain_3
HostName mydomain_3.example.com
```
When you press the tab key, it will display:
```
| ssh
my-ip 192.168.50.237
mydomain mydomain.example.com
my-domain-2 mydomain-2.example.com
my_domain_3 mydomain_3.example.com
```