Skip to content

Commit 553e688

Browse files
committed
recipe: add ssh-list-ids, fix ssh-list-{ips,names} for new cfg
1 parent 4bd0807 commit 553e688

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Justfile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,14 +821,26 @@ ssh-for-all *ARGS:
821821
ssh-for-each HOSTNAMES *ARGS:
822822
colmena exec --verbose --parallel 0 --on {{HOSTNAMES}} {{ARGS}}
823823

824+
# List machine ips based on regex pattern
825+
ssh-list-ids PATTERN:
826+
#!/usr/bin/env nu
827+
scj dump /dev/stdout -c .ssh_config
828+
| from json
829+
| default "" Host
830+
| default "" HostName
831+
| where not ($it.Host =~ ".ipv(4|6)$")
832+
| where Host =~ "{{PATTERN}}"
833+
| get HostName
834+
| str join " "
835+
824836
# List machine ips based on regex pattern
825837
ssh-list-ips PATTERN:
826838
#!/usr/bin/env nu
827839
scj dump /dev/stdout -c .ssh_config
828840
| from json
829841
| default "" Host
830842
| default "" HostName
831-
| where not ($it.Host | str ends-with ".ipv6")
843+
| where not ($it.Host =~ ".ipv(4|6)$")
832844
| where Host =~ "{{PATTERN}}"
833845
| get HostName
834846
| str join " "
@@ -840,7 +852,7 @@ ssh-list-names PATTERN:
840852
| from json
841853
| default "" Host
842854
| default "" HostName
843-
| where not ($it.Host | str ends-with ".ipv6")
855+
| where not ($it.Host =~ ".ipv(4|6)$")
844856
| where Host =~ "{{PATTERN}}"
845857
| get Host
846858
| str join " "

0 commit comments

Comments
 (0)