fix completion
This commit is contained in:
parent
1f5fe13805
commit
fa250e2ae3
@ -126,7 +126,7 @@ from .connapp import connapp
|
|||||||
from pkg_resources import get_distribution
|
from pkg_resources import get_distribution
|
||||||
|
|
||||||
__all__ = ["node", "nodes", "configfile", "connapp"]
|
__all__ = ["node", "nodes", "configfile", "connapp"]
|
||||||
__version__ = "2.0.1"
|
__version__ = "2.0.2"
|
||||||
__author__ = "Federico Luzzi"
|
__author__ = "Federico Luzzi"
|
||||||
__pdoc__ = {
|
__pdoc__ = {
|
||||||
'core': False,
|
'core': False,
|
||||||
|
@ -690,9 +690,11 @@ _conn()
|
|||||||
{
|
{
|
||||||
|
|
||||||
DATADIR=$HOME/.config/conn
|
DATADIR=$HOME/.config/conn
|
||||||
|
command -v jq >/dev/null 2>&1 && {
|
||||||
mapfile -t connections < <(jq -r ' .["connections"] | paths as $path | select(getpath($path) == "connection") | $path | [map(select(. != "type"))[-1,-2,-3]] | map(select(. !=null)) | join("@")' $DATADIR/config.json)
|
mapfile -t connections < <(jq -r ' .["connections"] | paths as $path | select(getpath($path) == "connection") | $path | [map(select(. != "type"))[-1,-2,-3]] | map(select(. !=null)) | join("@")' $DATADIR/config.json)
|
||||||
mapfile -t folders < <(jq -r ' .["connections"] | paths as $path | select(getpath($path) == "folder" or getpath($path) == "subfolder") | $path | [map(select(. != "type"))[-1,-2]] | map(select(. !=null)) | join("@")' $DATADIR/config.json)
|
mapfile -t folders < <(jq -r ' .["connections"] | paths as $path | select(getpath($path) == "folder" or getpath($path) == "subfolder") | $path | [map(select(. != "type"))[-1,-2]] | map(select(. !=null)) | join("@")' $DATADIR/config.json)
|
||||||
mapfile -t profiles < <(jq -r '.["profiles"] | keys[]' $DATADIR/config.json)
|
mapfile -t profiles < <(jq -r '.["profiles"] | keys[]' $DATADIR/config.json)
|
||||||
|
}
|
||||||
if [ "${#COMP_WORDS[@]}" = "2" ]; then
|
if [ "${#COMP_WORDS[@]}" = "2" ]; then
|
||||||
strings="--add --del --rm --edit --mod --show mv move ls list cp copy profile bulk config --help"
|
strings="--add --del --rm --edit --mod --show mv move ls list cp copy profile bulk config --help"
|
||||||
strings="$strings ${connections[@]} ${folders[@]/#/@}"
|
strings="$strings ${connections[@]} ${folders[@]/#/@}"
|
||||||
@ -733,7 +735,6 @@ _conn()
|
|||||||
}
|
}
|
||||||
complete -o nosort -F _conn conn
|
complete -o nosort -F _conn conn
|
||||||
complete -o nosort -F _conn connpy
|
complete -o nosort -F _conn connpy
|
||||||
|
|
||||||
'''
|
'''
|
||||||
if type == "zshcompletion":
|
if type == "zshcompletion":
|
||||||
return '''
|
return '''
|
||||||
@ -750,12 +751,14 @@ _conn()
|
|||||||
if [[ $words =~ '.* $' ]]; then
|
if [[ $words =~ '.* $' ]]; then
|
||||||
num=$(($num + 1))
|
num=$(($num + 1))
|
||||||
fi
|
fi
|
||||||
x=`jq -r ' .["connections"] | paths as $path | select(getpath($path) == "connection") | $path | [map(select(. != "type"))[-1,-2,-3]] | map(select(. !=null)) | join("@")' /home/fluzzi32/.config/conn/config.json`
|
command -v jq >/dev/null 2>&1 && {
|
||||||
|
x=`jq -r ' .["connections"] | paths as $path | select(getpath($path) == "connection") | $path | [map(select(. != "type"))[-1,-2,-3]] | map(select(. !=null)) | join("@")' $DATADIR/config.json`
|
||||||
connections=( $x )
|
connections=( $x )
|
||||||
x=`jq -r ' .["connections"] | paths as $path | select(getpath($path) == "folder" or getpath($path) == "subfolder") | $path | [map(select(. != "type"))[-1,-2]] | map(select(. !=null)) | join("@")' $DATADIR/config.json | sed -e 's/^/@/'`
|
x=`jq -r ' .["connections"] | paths as $path | select(getpath($path) == "folder" or getpath($path) == "subfolder") | $path | [map(select(. != "type"))[-1,-2]] | map(select(. !=null)) | join("@")' $DATADIR/config.json | sed -e 's/^/@/'`
|
||||||
folders=( $x )
|
folders=( $x )
|
||||||
x=`jq -r '.["profiles"] | keys[]' $DATADIR/config.json`
|
x=`jq -r '.["profiles"] | keys[]' $DATADIR/config.json`
|
||||||
profiles=( $x )
|
profiles=( $x )
|
||||||
|
}
|
||||||
if [ "${num}" = "2" ]; then
|
if [ "${num}" = "2" ]; then
|
||||||
strings="--add --del --rm --edit --mod --show mv move ls list cp copy profile bulk config --help"
|
strings="--add --del --rm --edit --mod --show mv move ls list cp copy profile bulk config --help"
|
||||||
strings="$strings ${connections[@]} ${folders[@]}"
|
strings="$strings ${connections[@]} ${folders[@]}"
|
||||||
|
@ -259,7 +259,7 @@ from .connapp import connapp
|
|||||||
from pkg_resources import get_distribution
|
from pkg_resources import get_distribution
|
||||||
|
|
||||||
__all__ = ["node", "nodes", "configfile", "connapp"]
|
__all__ = ["node", "nodes", "configfile", "connapp"]
|
||||||
__version__ = "2.0.1"
|
__version__ = "2.0.2"
|
||||||
__author__ = "Federico Luzzi"
|
__author__ = "Federico Luzzi"
|
||||||
__pdoc__ = {
|
__pdoc__ = {
|
||||||
'core': False,
|
'core': False,
|
||||||
@ -1289,9 +1289,11 @@ _conn()
|
|||||||
{
|
{
|
||||||
|
|
||||||
DATADIR=$HOME/.config/conn
|
DATADIR=$HOME/.config/conn
|
||||||
|
command -v jq >/dev/null 2>&1 && {
|
||||||
mapfile -t connections < <(jq -r ' .["connections"] | paths as $path | select(getpath($path) == "connection") | $path | [map(select(. != "type"))[-1,-2,-3]] | map(select(. !=null)) | join("@")' $DATADIR/config.json)
|
mapfile -t connections < <(jq -r ' .["connections"] | paths as $path | select(getpath($path) == "connection") | $path | [map(select(. != "type"))[-1,-2,-3]] | map(select(. !=null)) | join("@")' $DATADIR/config.json)
|
||||||
mapfile -t folders < <(jq -r ' .["connections"] | paths as $path | select(getpath($path) == "folder" or getpath($path) == "subfolder") | $path | [map(select(. != "type"))[-1,-2]] | map(select(. !=null)) | join("@")' $DATADIR/config.json)
|
mapfile -t folders < <(jq -r ' .["connections"] | paths as $path | select(getpath($path) == "folder" or getpath($path) == "subfolder") | $path | [map(select(. != "type"))[-1,-2]] | map(select(. !=null)) | join("@")' $DATADIR/config.json)
|
||||||
mapfile -t profiles < <(jq -r '.["profiles"] | keys[]' $DATADIR/config.json)
|
mapfile -t profiles < <(jq -r '.["profiles"] | keys[]' $DATADIR/config.json)
|
||||||
|
}
|
||||||
if [ "${#COMP_WORDS[@]}" = "2" ]; then
|
if [ "${#COMP_WORDS[@]}" = "2" ]; then
|
||||||
strings="--add --del --rm --edit --mod --show mv move ls list cp copy profile bulk config --help"
|
strings="--add --del --rm --edit --mod --show mv move ls list cp copy profile bulk config --help"
|
||||||
strings="$strings ${connections[@]} ${folders[@]/#/@}"
|
strings="$strings ${connections[@]} ${folders[@]/#/@}"
|
||||||
@ -1332,7 +1334,6 @@ _conn()
|
|||||||
}
|
}
|
||||||
complete -o nosort -F _conn conn
|
complete -o nosort -F _conn conn
|
||||||
complete -o nosort -F _conn connpy
|
complete -o nosort -F _conn connpy
|
||||||
|
|
||||||
'''
|
'''
|
||||||
if type == "zshcompletion":
|
if type == "zshcompletion":
|
||||||
return '''
|
return '''
|
||||||
@ -1349,12 +1350,14 @@ _conn()
|
|||||||
if [[ $words =~ '.* $' ]]; then
|
if [[ $words =~ '.* $' ]]; then
|
||||||
num=$(($num + 1))
|
num=$(($num + 1))
|
||||||
fi
|
fi
|
||||||
x=`jq -r ' .["connections"] | paths as $path | select(getpath($path) == "connection") | $path | [map(select(. != "type"))[-1,-2,-3]] | map(select(. !=null)) | join("@")' /home/fluzzi32/.config/conn/config.json`
|
command -v jq >/dev/null 2>&1 && {
|
||||||
|
x=`jq -r ' .["connections"] | paths as $path | select(getpath($path) == "connection") | $path | [map(select(. != "type"))[-1,-2,-3]] | map(select(. !=null)) | join("@")' $DATADIR/config.json`
|
||||||
connections=( $x )
|
connections=( $x )
|
||||||
x=`jq -r ' .["connections"] | paths as $path | select(getpath($path) == "folder" or getpath($path) == "subfolder") | $path | [map(select(. != "type"))[-1,-2]] | map(select(. !=null)) | join("@")' $DATADIR/config.json | sed -e 's/^/@/'`
|
x=`jq -r ' .["connections"] | paths as $path | select(getpath($path) == "folder" or getpath($path) == "subfolder") | $path | [map(select(. != "type"))[-1,-2]] | map(select(. !=null)) | join("@")' $DATADIR/config.json | sed -e 's/^/@/'`
|
||||||
folders=( $x )
|
folders=( $x )
|
||||||
x=`jq -r '.["profiles"] | keys[]' $DATADIR/config.json`
|
x=`jq -r '.["profiles"] | keys[]' $DATADIR/config.json`
|
||||||
profiles=( $x )
|
profiles=( $x )
|
||||||
|
}
|
||||||
if [ "${num}" = "2" ]; then
|
if [ "${num}" = "2" ]; then
|
||||||
strings="--add --del --rm --edit --mod --show mv move ls list cp copy profile bulk config --help"
|
strings="--add --del --rm --edit --mod --show mv move ls list cp copy profile bulk config --help"
|
||||||
strings="$strings ${connections[@]} ${folders[@]}"
|
strings="$strings ${connections[@]} ${folders[@]}"
|
||||||
|
Loading…
Reference in New Issue
Block a user