mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +00:00
feat(completion): support -G, -E, -N options
This commit is contained in:
parent
20dfe8049f
commit
f35511dfb3
3 changed files with 169 additions and 143 deletions
|
@ -8,10 +8,10 @@ for version_option in v V
|
||||||
complete -c $command -s $version_option -d 'Show version'
|
complete -c $command -s $version_option -d 'Show version'
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l graph_attributes = _background \
|
set -l graph_attributes _background \
|
||||||
bb \
|
bb \
|
||||||
'beautify true false' \
|
'beautify true false' \
|
||||||
bgcolor \
|
"bgcolor $(string join ' ' -- (__fish_graphviz__print_colors))" \
|
||||||
'center true false' \
|
'center true false' \
|
||||||
'charset utf-8 utf8 iso-8859-1 ISO_8859-1 ISO8859-1 ISO-IR-100 Latin1 l1 latin-1 big-5 big5' \
|
'charset utf-8 utf8 iso-8859-1 ISO_8859-1 ISO8859-1 ISO-IR-100 Latin1 l1 latin-1 big-5 big5' \
|
||||||
class \
|
class \
|
||||||
|
@ -29,7 +29,7 @@ set -l graph_attributes = _background \
|
||||||
epsilon \
|
epsilon \
|
||||||
'esep +3' \
|
'esep +3' \
|
||||||
"fontcolor $(string join ' ' -- (__fish_graphviz__print_colors))" \
|
"fontcolor $(string join ' ' -- (__fish_graphviz__print_colors))" \
|
||||||
fontname \
|
'fontname Times-Roman' \
|
||||||
'fontnames svg' \
|
'fontnames svg' \
|
||||||
fontpath \
|
fontpath \
|
||||||
'fontsize 14.0' \
|
'fontsize 14.0' \
|
||||||
|
@ -39,69 +39,69 @@ set -l graph_attributes = _background \
|
||||||
id \
|
id \
|
||||||
imagepath \
|
imagepath \
|
||||||
inputscale \
|
inputscale \
|
||||||
K \
|
'K 0.3' \
|
||||||
label \
|
label \
|
||||||
label_scheme \
|
'label_scheme 0 1 2 3' \
|
||||||
labeljust \
|
'labeljust r c l' \
|
||||||
labelloc \
|
'labelloc t b' \
|
||||||
landscape \
|
'landscape true false' \
|
||||||
layerlistsep \
|
'layerlistsep ,' \
|
||||||
layers \
|
layers \
|
||||||
layerselect \
|
layerselect \
|
||||||
layersep \
|
'layersep :\t' \
|
||||||
layout \
|
layout \
|
||||||
levels \
|
'levels INT_MAX' \
|
||||||
levelsgap \
|
'levelsgap 0.0' \
|
||||||
lheight \
|
lheight \
|
||||||
linelength \
|
'linelength 128' \
|
||||||
lp \
|
lp \
|
||||||
lwidth \
|
lwidth \
|
||||||
margin \
|
margin \
|
||||||
maxiter \
|
maxiter \
|
||||||
mclimit \
|
'mclimit 1.0' \
|
||||||
mindist \
|
'mindist 1.0' \
|
||||||
mode \
|
'mode major KK sgd hier ipsep' \
|
||||||
model \
|
'model shortpath circuit subset' \
|
||||||
newrank \
|
'newrank true false' \
|
||||||
nodesep \
|
'nodesep 0.25' \
|
||||||
nojustify \
|
'nojustify true false' \
|
||||||
normalize \
|
'normalize false' \
|
||||||
notranslate \
|
'notranslate true false' \
|
||||||
nslimit \
|
nslimit \
|
||||||
nslimit1 \
|
nslimit1 \
|
||||||
oneblock \
|
'oneblock true false' \
|
||||||
ordering \
|
'ordering in out' \
|
||||||
orientation \
|
'orientation 0.0' \
|
||||||
outputorder \
|
'outputorder breadthfirst' \
|
||||||
overlap \
|
'overlap true false' \
|
||||||
overlap_scaling \
|
'overlap_scaling -4' \
|
||||||
overlap_shrink \
|
'overlap_shrink true false' \
|
||||||
pack \
|
'pack true false' \
|
||||||
packmode \
|
'packmode node' \
|
||||||
pad \
|
'pad 0.0555' \
|
||||||
page \
|
page \
|
||||||
pagedir \
|
'pagedir BL' \
|
||||||
quadtree \
|
'quadtree normal none fase true false 2' \
|
||||||
quantum \
|
quantum \
|
||||||
rankdir \
|
'rankdir 0.0' \
|
||||||
ranksep \
|
'ranksep 0.5' \
|
||||||
ratio \
|
'ratio fill compress expand auto' \
|
||||||
remincross \
|
'remincross true false' \
|
||||||
repulsiveforce \
|
'repulsiveforce 1.0' \
|
||||||
resolution \
|
'resolution 96.0' \
|
||||||
root \
|
root \
|
||||||
rotate \
|
'rotate 0' \
|
||||||
rotation \
|
'rotation 0' \
|
||||||
scale \
|
scale \
|
||||||
searchsize \
|
'searchsize 30' \
|
||||||
sep \
|
'sep +4' \
|
||||||
showboxes \
|
'showboxes 0 1 2' \
|
||||||
size \
|
size \
|
||||||
smoothing \
|
'smoothing none' \
|
||||||
sortv \
|
'sortv 0' \
|
||||||
splines \
|
splines \
|
||||||
start \
|
start \
|
||||||
style \
|
'style filled invis' \
|
||||||
stylesheet \
|
stylesheet \
|
||||||
target \
|
target \
|
||||||
TBbalance \
|
TBbalance \
|
||||||
|
@ -109,125 +109,98 @@ set -l graph_attributes = _background \
|
||||||
truecolor \
|
truecolor \
|
||||||
URL \
|
URL \
|
||||||
viewport \
|
viewport \
|
||||||
voro_margin \
|
'voro_margin 0.05' \
|
||||||
xdotversion
|
xdotversion \
|
||||||
|
'sides 0'
|
||||||
|
|
||||||
set -l edge_attributes area \
|
set -l edge_attributes class \
|
||||||
class \
|
"color $(string join ' ' -- (__fish_graphviz__print_colors))" \
|
||||||
color \
|
|
||||||
colorscheme \
|
colorscheme \
|
||||||
comment \
|
comment \
|
||||||
distortion \
|
"fillcolor $(string join ' ' -- (__fish_graphviz__print_colors))" \
|
||||||
fillcolor \
|
"fontcolor $(string join ' ' -- (__fish_graphviz__print_colors))" \
|
||||||
fixedsize \
|
'fontname Times-Roman' \
|
||||||
fontcolor \
|
'fontsize 14.0' \
|
||||||
fontname \
|
|
||||||
fontsize \
|
|
||||||
gradientangle \
|
|
||||||
group \
|
|
||||||
height \
|
|
||||||
href \
|
href \
|
||||||
id \
|
id \
|
||||||
image \
|
|
||||||
imagepos \
|
|
||||||
imagescale \
|
|
||||||
label \
|
label \
|
||||||
labelloc \
|
|
||||||
layer \
|
layer \
|
||||||
margin \
|
'nojustify true false' \
|
||||||
nojustify \
|
'penwidth 1.0' \
|
||||||
ordering \
|
|
||||||
orientation \
|
|
||||||
penwidth \
|
|
||||||
peripheries \
|
|
||||||
pin \
|
|
||||||
pos \
|
pos \
|
||||||
rects \
|
|
||||||
regular \
|
|
||||||
root \
|
|
||||||
samplepoints \
|
|
||||||
shape \
|
|
||||||
shapefile \
|
shapefile \
|
||||||
showboxes \
|
'showboxes 0 1 2' \
|
||||||
sides \
|
'sides 0' \
|
||||||
skew \
|
'style filled invis' \
|
||||||
sortv \
|
|
||||||
style \
|
|
||||||
target \
|
target \
|
||||||
tooltip \
|
tooltip \
|
||||||
URL \
|
URL \
|
||||||
vertices \
|
|
||||||
width \
|
|
||||||
xlabel \
|
xlabel \
|
||||||
xlp \
|
xlp \
|
||||||
z
|
lp
|
||||||
|
|
||||||
set -l node_attributes area \
|
set -l node_attributes area \
|
||||||
class \
|
class \
|
||||||
color \
|
"color $(string join ' ' -- (__fish_graphviz__print_colors))" \
|
||||||
colorscheme \
|
colorscheme \
|
||||||
comment \
|
comment \
|
||||||
distortion \
|
'distortion 0.0' \
|
||||||
fillcolor \
|
"fillcolor $(string join ' ' -- (__fish_graphviz__print_colors))" \
|
||||||
fixedsize \
|
'fixedsize false true shape' \
|
||||||
fontcolor \
|
"fontcolor $(string join ' ' -- (__fish_graphviz__print_colors))" \
|
||||||
fontname \
|
'fontname Times-Roman' \
|
||||||
fontsize \
|
fontsize \
|
||||||
gradientangle \
|
'gradientangle 0' \
|
||||||
group \
|
group \
|
||||||
height \
|
'height 0.5' \
|
||||||
href \
|
href \
|
||||||
id \
|
id \
|
||||||
image \
|
image \
|
||||||
imagepos \
|
'imagepos tl tc tr ml mc mr bl bc br' \
|
||||||
imagescale \
|
'imagescale false true width height both' \
|
||||||
label \
|
'label \N' \
|
||||||
labelloc \
|
'labelloc t c b' \
|
||||||
layer \
|
layer \
|
||||||
margin \
|
margin \
|
||||||
nojustify \
|
'nojustify true false' \
|
||||||
ordering \
|
'ordering in out' \
|
||||||
orientation \
|
'orientation 0.0' \
|
||||||
penwidth \
|
'penwidth 1.0' \
|
||||||
peripheries \
|
peripheries \
|
||||||
pin \
|
'pin false' \
|
||||||
pos \
|
pos \
|
||||||
rects \
|
rects \
|
||||||
regular \
|
'regular true false' \
|
||||||
root \
|
'root false' \
|
||||||
samplepoints \
|
'samplepoints 8' \
|
||||||
shape \
|
"shape $(string join ' ' -- (__fish_graphviz__print_shapes))" \
|
||||||
shapefile \
|
shapefile \
|
||||||
showboxes \
|
'showboxes 0 1 2' \
|
||||||
sides \
|
'sides 0' \
|
||||||
skew \
|
'skew 0' \
|
||||||
sortv \
|
'sortv 0' \
|
||||||
style \
|
'style filled invis' \
|
||||||
target \
|
target \
|
||||||
tooltip \
|
tooltip \
|
||||||
URL \
|
URL \
|
||||||
vertices \
|
vertices \
|
||||||
width \
|
'width 0.75' \
|
||||||
xlabel \
|
xlabel \
|
||||||
xlp \
|
xlp \
|
||||||
z
|
'z 0.0'
|
||||||
|
|
||||||
complete -c $command \
|
complete -c $command -s G \
|
||||||
-a '(__fish_complete_key_value_pairs $graph_attributes)' \
|
-a '(__fish_complete_key_value_pairs = $graph_attributes)' \
|
||||||
-d 'Specify a graph option'
|
-d 'Specify a graph option for a diagram'
|
||||||
|
|
||||||
complete -c $command \
|
complete -c $command -s E \
|
||||||
-a '(__fish_complete_key_value_pairs $edge_attributes)' \
|
-a '(__fish_complete_key_value_pairs = $edge_attributes)' \
|
||||||
-d 'Specify an edge option'
|
-d 'Specify an edge option for a diagram'
|
||||||
|
|
||||||
complete -c $command \
|
complete -c $command -s N \
|
||||||
-a '(__fish_complete_key_value_pairs $node_attributes)' \
|
-a '(__fish_complete_key_value_pairs = $node_attributes)' \
|
||||||
-d 'Specify a node option'
|
-d 'Specify a node option for a diagram'
|
||||||
|
|
||||||
##
|
complete -c $command -s k \
|
||||||
__fish_complete_key_value_pairs = "type executable library" "id first second"
|
-a 'dot neato fdp sfdp circo twopi nop Pretty-nop2 Pretty-osage patchwork' \
|
||||||
|
-d 'Specify a render engine for a diagram'
|
||||||
complete --erase true
|
|
||||||
complete -c true -s o -l option -r \
|
|
||||||
-a '(__fish_complete_key_value_pairs = "type executable library" "id first second")' \
|
|
||||||
-d 'Some description'
|
|
||||||
|
|
|
@ -8,11 +8,9 @@ function __fish_complete_key_value_pairs \
|
||||||
set keys $argv[2..]
|
set keys $argv[2..]
|
||||||
set values $keys
|
set values $keys
|
||||||
|
|
||||||
set token (string replace --regex "^--?\w+$delimiter" '' -- $token)
|
|
||||||
|
|
||||||
for index in (seq (count $keys))
|
for index in (seq (count $keys))
|
||||||
set definition $keys[$index]
|
set definition $keys[$index]
|
||||||
set keys[$index] (string match --regex '^\w+' -- $definition)
|
set keys[$index] "$(string match --regex '^\w+' -- $definition)"
|
||||||
|
|
||||||
if string match --quiet --regex '^\w+\s+' -- $definition
|
if string match --quiet --regex '^\w+\s+' -- $definition
|
||||||
set values[$index] (string replace --regex '^\w+\s+' '' -- $definition)
|
set values[$index] (string replace --regex '^\w+\s+' '' -- $definition)
|
||||||
|
@ -21,15 +19,9 @@ function __fish_complete_key_value_pairs \
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
set token (string replace --regex "$delimiter.*\$" '' -- $token)
|
for key in $keys
|
||||||
|
set index (contains --index -- "$key" $keys)
|
||||||
if set index (contains --index -- "$token" $keys)
|
set value_list (string split " " -- $values[$index])
|
||||||
for value in (string split " " $values[$index])
|
echo $key=$value_list | string split " "
|
||||||
printf '%s%s%s\n' $token $delimiter $value
|
|
||||||
end
|
|
||||||
else
|
|
||||||
for key in (string split " " $keys)
|
|
||||||
printf '%s%s\n' $key $delimiter
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
61
share/functions/__fish_graphviz__print_shapes.fish
Normal file
61
share/functions/__fish_graphviz__print_shapes.fish
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
function __fish_graphviz__print_shapes
|
||||||
|
echo box \
|
||||||
|
polygon \
|
||||||
|
ellipse \
|
||||||
|
oval \
|
||||||
|
circle \
|
||||||
|
point \
|
||||||
|
egg \
|
||||||
|
triangle \
|
||||||
|
plaintext \
|
||||||
|
plain \
|
||||||
|
diamond \
|
||||||
|
trapezium \
|
||||||
|
parallelogram \
|
||||||
|
house \
|
||||||
|
pentagon \
|
||||||
|
hexagon \
|
||||||
|
septagon \
|
||||||
|
octagon \
|
||||||
|
doublecircle \
|
||||||
|
doubleoctagon \
|
||||||
|
tripleoctagon \
|
||||||
|
invtriangle \
|
||||||
|
invtrapezium \
|
||||||
|
invhouse \
|
||||||
|
Mdiamond \
|
||||||
|
Msquare \
|
||||||
|
Mcircle \
|
||||||
|
rect \
|
||||||
|
rectangle \
|
||||||
|
square \
|
||||||
|
star \
|
||||||
|
none \
|
||||||
|
underline \
|
||||||
|
cylinder \
|
||||||
|
note \
|
||||||
|
tab \
|
||||||
|
folder \
|
||||||
|
box3d \
|
||||||
|
component \
|
||||||
|
promoter \
|
||||||
|
cds \
|
||||||
|
terminator \
|
||||||
|
utr \
|
||||||
|
primersite \
|
||||||
|
restrictionsite \
|
||||||
|
fivepoverhang \
|
||||||
|
threepoverhang \
|
||||||
|
noverhang \
|
||||||
|
assembly \
|
||||||
|
signature \
|
||||||
|
insulator \
|
||||||
|
ribosite \
|
||||||
|
rnastab \
|
||||||
|
proteasesite \
|
||||||
|
proteinstab \
|
||||||
|
rpromoter \
|
||||||
|
rarrow \
|
||||||
|
larrow \
|
||||||
|
lpromoter
|
||||||
|
end
|
Loading…
Reference in a new issue