1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 22:57:46 +00:00

ssh complete cache use whitelist (ignore known_hosts and keys) (#553)

docker run add -p(privileged) option
    nvc nvdc for neovim remote-ui

Co-authored-by: agent <agent@nuc>
This commit is contained in:
fj0r 2023-07-15 19:57:23 +08:00 committed by GitHub
parent 3fa732f1e2
commit b06dfb664e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 8 deletions

View file

@ -1,5 +1,13 @@
export def ensure-cache [cache path action] {
let ts = (do -i { ls $path | sort-by modified | reverse | get 0.modified })
export def ensure-cache [cache paths action] {
mut cfgs = []
for i in $paths {
let cs = (do -i {ls $i})
if not ($cs | is-empty) {
$cfgs = ($cfgs | append $cs)
}
}
let cfgs = $cfgs
let ts = ($cfgs | sort-by modified | reverse | get 0.modified)
if ($ts | is-empty) { return false }
let tc = (do -i { ls $cache | get 0.modified })
if not (($cache | path exists) and ($ts < $tc)) {
@ -50,7 +58,7 @@ def fmt-group [p] {
def "ssh-hosts" [] {
let cache = $'($env.HOME)/.cache/nu-complete/ssh.json'
ensure-cache $cache ~/.ssh/**/* { ||
ensure-cache $cache [~/.ssh/config ~/.ssh/config*/* ] { ||
let data = (ssh-list | each {|x|
let uri = $"($x.User)@($x.HostName):($x.Port)"
{