mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37: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:
parent
3fa732f1e2
commit
b06dfb664e
4 changed files with 22 additions and 8 deletions
|
@ -276,6 +276,7 @@ export def dr [
|
|||
--entrypoint: string # entrypoint
|
||||
--dry-run: bool
|
||||
--with-x: bool
|
||||
--privileged(-P): bool
|
||||
--namespace(-n): string@"nu-complete docker ns"
|
||||
img: string@"nu-complete docker images" # image
|
||||
...cmd # command args
|
||||
|
@ -290,6 +291,7 @@ export def dr [
|
|||
let ports = if ($ports|is-empty) { [] } else { $ports | transpose k v | each {|x| [-p $"($x.k):($x.v)"] } | flatten }
|
||||
let debug = (sprb $debug [--cap-add=SYS_ADMIN --cap-add=SYS_PTRACE --security-opt seccomp=unconfined])
|
||||
#let appimage = (sprb $appimage [--device /dev/fuse --security-opt apparmor:unconfined])
|
||||
let privileged = (sprb $privileged [--privileged])
|
||||
let appimage = (sprb $appimage [--device /dev/fuse])
|
||||
let netadmin = (sprb $netadmin [--cap-add=NET_ADMIN --device /dev/net/tun])
|
||||
let clip = (sprb $with_x [-e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix])
|
||||
|
@ -306,7 +308,7 @@ export def dr [
|
|||
}
|
||||
let cache = (spr [-v $cache])
|
||||
let args = ([
|
||||
$entrypoint $attach $daemon
|
||||
$privileged $entrypoint $attach $daemon
|
||||
$ports $envs $ssh $proxy
|
||||
$debug $appimage $netadmin $clip
|
||||
$mnt $vols $workdir $cache
|
||||
|
|
|
@ -160,7 +160,7 @@ export def gb [
|
|||
if $branch in $bs and (agree 'branch will be delete!') {
|
||||
git branch -D $branch
|
||||
}
|
||||
if $branch in (remote_braches | each {|x| $x.1}) and (agree -n 'delete remote branch?!') {
|
||||
if $branch in (remote_braches | each {|x| $x.1}) and (agree 'delete remote branch?!') {
|
||||
let remote = if ($remote|is-empty) { 'origin' } else { $remote }
|
||||
git branch -D -r $'($remote)/($branch)'
|
||||
git push $remote -d $branch
|
||||
|
|
|
@ -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)"
|
||||
{
|
||||
|
|
|
@ -134,10 +134,14 @@ export def opwd [] {
|
|||
nvim-lua 'OppositePwd()'
|
||||
}
|
||||
|
||||
export def nvim-srv [port: int=1111] {
|
||||
export def nvim-srv [port: int=9999] {
|
||||
nvim --headless --listen $"0.0.0.0:($port)"
|
||||
}
|
||||
|
||||
export def nvide-conn [addr: string] {
|
||||
neovide --multigrid --maximized --remote-tcp addr
|
||||
export def nvc [addr: string] {
|
||||
nvim --remote-ui --server $addr
|
||||
}
|
||||
|
||||
export def nvdc [addr: string] {
|
||||
neovide --multigrid --maximized --server $addr
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue