maj de la configuration

This commit is contained in:
bvaudour 2020-07-22 11:24:43 +02:00
parent df4f2c07c1
commit 2dac13303d
20 changed files with 210 additions and 69 deletions

View file

@ -11,7 +11,7 @@ commands = [
extensions = [ tar bz2 zip gz lz4 sz xz zst rar ]
fn -comp-commands { explode $commands }
fn -comp-commands { all $commands }
fn -comp-archive-files [m]{
local:type = (condition:set (eq $m '') prefix deep-prefix)

View file

@ -32,7 +32,7 @@ np = [
fn complete [@argv]{
local:c = (count $argv)
if (== $c 2) {
explode $options
all $options
} elif (and (== $c 3) (has-value $np $argv[-2])) {
-remotes-packages
}

View file

@ -11,13 +11,14 @@ fn -repo-packages {
put $p
})]
local:spackages = [&]
use str
peach [p]{
splits '/' $p
str:split '/' $p
} $packages | peach [e]{
spackages[$e] = $nil
}
keys $spackages
explode $packages
all $packages
}
fn -downloaded-packages [m]{
@ -83,7 +84,7 @@ fpack = [
fn complete [@argv]{
local:c = (count $argv)
if (< $c 3) {
explode $options
all $options
} else {
local:cmd = $argv[1]
if (and (== $c 3) (has-value $asdeps $cmd)) {

View file

@ -44,11 +44,11 @@ fn -init-hosts {
fn -init-known-hosts {
local:khosts = [&22=[&]]
cat ~/.ssh/known_hosts | peach [l]{
put [(splits ' ' $l)]
put [(str:split ' ' $l)]
} | peach [e]{
local:domains @local:id = $@e
id = (joins ' ' $id)
splits ',' $domains | peach [d]{
id = (str:join ' ' $id)
str:split ',' $domains | peach [d]{
local:d = $d
local:port = 22
if (eq $d[0] '[') {
@ -105,10 +105,10 @@ fn -init-history {
if (and (< $i $c) (or (and (eq $cmd ssh) (eq $arg -p)) (eq $arg -P))) {
port = $argv[(+ $i 1)]
} else {
local:nd = [(splits '@' $arg)]
local:nd = [(str:split '@' $arg)]
if (== (count $nd) 2) {
name = $nd[0]
domain @_ = (splits ':' $nd[1])
domain @_ = (str:split ':' $nd[1])
break
}
}
@ -207,14 +207,14 @@ fn -complete-args [cmd @argv]{
port = $port[-1]
}
local:larg = $argv[-1]
local:name @local:host = (splits '@' $larg)
local:name @local:host = (str:split '@' $larg)
if (list:empty $host) {
-known-names &port=$port | each [n]{ put $n'@' }
if (eq $cmd 'scp') {
file:match-files $larg
}
} else {
host @_ = (splits ':' $host[0])
host @_ = (str:split ':' $host[0])
local:check = [h]{ has-prefix $h $host }
local:khosts = [(-known-hosts &port=$port &name=$name)]
if (not (list:contains $check $khosts)) {
@ -224,7 +224,7 @@ fn -complete-args [cmd @argv]{
}
}
each [h]{ put $name'@'$h } $khosts
explode $khosts
all $khosts
}
}

View file

@ -1,6 +1,6 @@
fn complete [@argv]{
if (and (> (count $argv) 2) (has-key $edit:completion:arg-completer $argv[1])) {
$edit:completion:arg-completer[$argv[1]] (explode $argv[1:])
$edit:completion:arg-completer[$argv[1]] (all $argv[1:])
} else {
edit:complete-sudo $@argv
}