adds devspace stuff
This commit is contained in:
1 parent
64a7732987
commit
ca10d71fa4
3 files changed
+248
-3
No files matched your search
@@ -4,12 +4,33 @@ clusters:
|
||||
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJkekNDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTNNdGMyVnkKZG1WeUxXTmhRREUyTXpNME5UazVNek13SGhjTk1qRXhNREExTVRnMU1qRXpXaGNOTXpFeE1EQXpNVGcxTWpFegpXakFqTVNFd0h3WURWUVFEREJock0zTXRjMlZ5ZG1WeUxXTmhRREUyTXpNME5UazVNek13V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFSNUhMZzh2OW50OFh6YkU2RUR6R2VMdzZNdXJ5Z1RuaDdGY2lrYXdLcWUKNjJFK2psUTRXcUVJVHNRaVRVNWFiKzNCczBZQnZSU2xWdWNhcGt4bjZkNTJvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVXZjRm9sdXVWeXR4K2Q0NGpkYmQyCm1iYzU4c2N3Q2dZSUtvWkl6ajBFQXdJRFNBQXdSUUlnSWJkVUlGMjMyZXIzSjk4bVl1T2ZEYkVhMU9Ccm82KzYKcG9yM3VGdTFEbHNDSVFEMEtSRlNGZ2Zsd3dSWFRxMkpTb3VzM09oOE0wSzV3djBuVlFWL2V1ekxuZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
|
||||
server: https://24.51.235.164:6443
|
||||
name: default
|
||||
- cluster:
|
||||
certificate-authority: /home/tmerritt/.minikube/ca.crt
|
||||
extensions:
|
||||
- extension:
|
||||
last-update: Sat, 14 Jan 2023 11:09:13 EST
|
||||
provider: minikube.sigs.k8s.io
|
||||
version: v1.28.0
|
||||
name: cluster_info
|
||||
server: https://192.168.49.2:8443
|
||||
name: minikube
|
||||
contexts:
|
||||
- context:
|
||||
cluster: default
|
||||
user: default
|
||||
name: default
|
||||
current-context: default
|
||||
- context:
|
||||
cluster: minikube
|
||||
extensions:
|
||||
- extension:
|
||||
last-update: Sat, 14 Jan 2023 11:09:13 EST
|
||||
provider: minikube.sigs.k8s.io
|
||||
version: v1.28.0
|
||||
name: context_info
|
||||
namespace: lilly
|
||||
user: minikube
|
||||
name: minikube
|
||||
current-context: minikube
|
||||
kind: Config
|
||||
preferences: {}
|
||||
users:
|
||||
@@ -17,3 +38,7 @@ users:
|
||||
user:
|
||||
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJrVENDQVRlZ0F3SUJBZ0lJUGtBSDRPTlRxWFF3Q2dZSUtvWkl6ajBFQXdJd0l6RWhNQjhHQTFVRUF3d1kKYXpOekxXTnNhV1Z1ZEMxallVQXhOak16TkRVNU9UTXpNQjRYRFRJeE1UQXdOVEU0TlRJeE0xb1hEVEl6TURjeApNVEV4TlRnME5Wb3dNREVYTUJVR0ExVUVDaE1PYzNsemRHVnRPbTFoYzNSbGNuTXhGVEFUQmdOVkJBTVRESE41CmMzUmxiVHBoWkcxcGJqQlpNQk1HQnlxR1NNNDlBZ0VHQ0NxR1NNNDlBd0VIQTBJQUJNM2JNY3VlYnNXSjBZT2UKdEtJeEU1VlM0djhVOFFRRVQ2azg3d1FheGhBcXE0Tnl2cWNmMFd5bWNQbzBFMVptd09CN1BDUEhndXAreVI1VApKcnZjUmo2alNEQkdNQTRHQTFVZER3RUIvd1FFQXdJRm9EQVRCZ05WSFNVRUREQUtCZ2dyQmdFRkJRY0RBakFmCkJnTlZIU01FR0RBV2dCU2hzQkM4WXJoaUR4ZnFUQzRqMFJqczBscUZiakFLQmdncWhrak9QUVFEQWdOSUFEQkYKQWlFQTJNVHREa2t2cE9XTW0vMmtWYjdtVXVoYWdvQzNGQ000aTdpZE4rczJPLzhDSUJhN1RlcXA5M1VqY2F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S1p3K2pRVFZtYkE0SHM4SThlQzZuN0pIbE1tdTl4R1BnPT0KLS0tLS1FTkQgRUMgUFJJVkFURSBLRVktLS0tLQo=
|
||||
- name: minikube
|
||||
user:
|
||||
client-certificate: /home/tmerritt/.minikube/profiles/minikube/client.crt
|
||||
client-key: /home/tmerritt/.minikube/profiles/minikube/client.key
|
||||
+15
-2
@@ -3,7 +3,7 @@ Host 192.168.0.141
|
||||
Host git.pyrocode.xyz
|
||||
Port 2222
|
||||
IdentitiesOnly yes
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
IdentityFile ~/.ssh/id_ed25519_
|
||||
# entry generated by okteto
|
||||
Host 172.24.4.115
|
||||
HostName 172.24.4.115
|
||||
@@ -25,6 +25,19 @@ Host api.okteto
|
||||
Host git.geekback.dev
|
||||
Port 2222
|
||||
IdentitiesOnly yes
|
||||
IdentityFile ~/.ssh/id_ed25519.pub
|
||||
IdentityFile ~/.ssh/id_ed25519
|
||||
# to generate new key
|
||||
# ssh-keygen -t ed25519 -C "tmerritt@yourcoolhost.xyz"
|
||||
Host pc101r
|
||||
Port 22222
|
||||
|
||||
# DevSpace Start app.lilly.devspace
|
||||
Host app.lilly.devspace
|
||||
HostName localhost
|
||||
LogLevel error
|
||||
Port 10463
|
||||
IdentityFile "/home/tmerritt/.devspace/ssh/id_devspace_ecdsa"
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile /dev/null
|
||||
User devspace
|
||||
# DevSpace End app.lilly.devspace
|
||||
@@ -0,0 +1,207 @@
|
||||
#compdef devspace
|
||||
|
||||
# zsh completion for devspace -*- shell-script -*-
|
||||
|
||||
__devspace_debug()
|
||||
{
|
||||
local file="$BASH_COMP_DEBUG_FILE"
|
||||
if [[ -n ${file} ]]; then
|
||||
echo "$*" >> "${file}"
|
||||
fi
|
||||
}
|
||||
|
||||
_devspace()
|
||||
{
|
||||
local shellCompDirectiveError=1
|
||||
local shellCompDirectiveNoSpace=2
|
||||
local shellCompDirectiveNoFileComp=4
|
||||
local shellCompDirectiveFilterFileExt=8
|
||||
local shellCompDirectiveFilterDirs=16
|
||||
|
||||
local lastParam lastChar flagPrefix requestComp out directive comp lastComp noSpace
|
||||
local -a completions
|
||||
|
||||
__devspace_debug "\n========= starting completion logic =========="
|
||||
__devspace_debug "CURRENT: ${CURRENT}, words[*]: ${words[*]}"
|
||||
|
||||
# The user could have moved the cursor backwards on the command-line.
|
||||
# We need to trigger completion from the $CURRENT location, so we need
|
||||
# to truncate the command-line ($words) up to the $CURRENT location.
|
||||
# (We cannot use $CURSOR as its value does not work when a command is an alias.)
|
||||
words=("${=words[1,CURRENT]}")
|
||||
__devspace_debug "Truncated words[*]: ${words[*]},"
|
||||
|
||||
lastParam=${words[-1]}
|
||||
lastChar=${lastParam[-1]}
|
||||
__devspace_debug "lastParam: ${lastParam}, lastChar: ${lastChar}"
|
||||
|
||||
# For zsh, when completing a flag with an = (e.g., devspace -n=<TAB>)
|
||||
# completions must be prefixed with the flag
|
||||
setopt local_options BASH_REMATCH
|
||||
if [[ "${lastParam}" =~ '-.*=' ]]; then
|
||||
# We are dealing with a flag with an =
|
||||
flagPrefix="-P ${BASH_REMATCH}"
|
||||
fi
|
||||
|
||||
# Prepare the command to obtain completions
|
||||
requestComp="${words[1]} __complete ${words[2,-1]}"
|
||||
if [ "${lastChar}" = "" ]; then
|
||||
# If the last parameter is complete (there is a space following it)
|
||||
# We add an extra empty parameter so we can indicate this to the go completion code.
|
||||
__devspace_debug "Adding extra empty parameter"
|
||||
requestComp="${requestComp} \"\""
|
||||
fi
|
||||
|
||||
__devspace_debug "About to call: eval ${requestComp}"
|
||||
|
||||
# Use eval to handle any environment variables and such
|
||||
out=$(eval ${requestComp} 2>/dev/null)
|
||||
__devspace_debug "completion output: ${out}"
|
||||
|
||||
# Extract the directive integer following a : from the last line
|
||||
local lastLine
|
||||
while IFS='\n' read -r line; do
|
||||
lastLine=${line}
|
||||
done < <(printf "%s\n" "${out[@]}")
|
||||
__devspace_debug "last line: ${lastLine}"
|
||||
|
||||
if [ "${lastLine[1]}" = : ]; then
|
||||
directive=${lastLine[2,-1]}
|
||||
# Remove the directive including the : and the newline
|
||||
local suffix
|
||||
(( suffix=${#lastLine}+2))
|
||||
out=${out[1,-$suffix]}
|
||||
else
|
||||
# There is no directive specified. Leave $out as is.
|
||||
__devspace_debug "No directive found. Setting do default"
|
||||
directive=0
|
||||
fi
|
||||
|
||||
__devspace_debug "directive: ${directive}"
|
||||
__devspace_debug "completions: ${out}"
|
||||
__devspace_debug "flagPrefix: ${flagPrefix}"
|
||||
|
||||
if [ $((directive & shellCompDirectiveError)) -ne 0 ]; then
|
||||
__devspace_debug "Completion received error. Ignoring completions."
|
||||
return
|
||||
fi
|
||||
|
||||
local activeHelpMarker="_activeHelp_ "
|
||||
local endIndex=${#activeHelpMarker}
|
||||
local startIndex=$((${#activeHelpMarker}+1))
|
||||
local hasActiveHelp=0
|
||||
while IFS='\n' read -r comp; do
|
||||
# Check if this is an activeHelp statement (i.e., prefixed with $activeHelpMarker)
|
||||
if [ "${comp[1,$endIndex]}" = "$activeHelpMarker" ];then
|
||||
__devspace_debug "ActiveHelp found: $comp"
|
||||
comp="${comp[$startIndex,-1]}"
|
||||
if [ -n "$comp" ]; then
|
||||
compadd -x "${comp}"
|
||||
__devspace_debug "ActiveHelp will need delimiter"
|
||||
hasActiveHelp=1
|
||||
fi
|
||||
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -n "$comp" ]; then
|
||||
# If requested, completions are returned with a description.
|
||||
# The description is preceded by a TAB character.
|
||||
# For zsh's _describe, we need to use a : instead of a TAB.
|
||||
# We first need to escape any : as part of the completion itself.
|
||||
comp=${comp//:/\\:}
|
||||
|
||||
local tab="$(printf '\t')"
|
||||
comp=${comp//$tab/:}
|
||||
|
||||
__devspace_debug "Adding completion: ${comp}"
|
||||
completions+=${comp}
|
||||
lastComp=$comp
|
||||
fi
|
||||
done < <(printf "%s\n" "${out[@]}")
|
||||
|
||||
# Add a delimiter after the activeHelp statements, but only if:
|
||||
# - there are completions following the activeHelp statements, or
|
||||
# - file completion will be performed (so there will be choices after the activeHelp)
|
||||
if [ $hasActiveHelp -eq 1 ]; then
|
||||
if [ ${#completions} -ne 0 ] || [ $((directive & shellCompDirectiveNoFileComp)) -eq 0 ]; then
|
||||
__devspace_debug "Adding activeHelp delimiter"
|
||||
compadd -x "--"
|
||||
hasActiveHelp=0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveNoSpace)) -ne 0 ]; then
|
||||
__devspace_debug "Activating nospace."
|
||||
noSpace="-S ''"
|
||||
fi
|
||||
|
||||
if [ $((directive & shellCompDirectiveFilterFileExt)) -ne 0 ]; then
|
||||
# File extension filtering
|
||||
local filteringCmd
|
||||
filteringCmd='_files'
|
||||
for filter in ${completions[@]}; do
|
||||
if [ ${filter[1]} != '*' ]; then
|
||||
# zsh requires a glob pattern to do file filtering
|
||||
filter="\*.$filter"
|
||||
fi
|
||||
filteringCmd+=" -g $filter"
|
||||
done
|
||||
filteringCmd+=" ${flagPrefix}"
|
||||
|
||||
__devspace_debug "File filtering command: $filteringCmd"
|
||||
_arguments '*:filename:'"$filteringCmd"
|
||||
elif [ $((directive & shellCompDirectiveFilterDirs)) -ne 0 ]; then
|
||||
# File completion for directories only
|
||||
local subdir
|
||||
subdir="${completions[1]}"
|
||||
if [ -n "$subdir" ]; then
|
||||
__devspace_debug "Listing directories in $subdir"
|
||||
pushd "${subdir}" >/dev/null 2>&1
|
||||
else
|
||||
__devspace_debug "Listing directories in ."
|
||||
fi
|
||||
|
||||
local result
|
||||
_arguments '*:dirname:_files -/'" ${flagPrefix}"
|
||||
result=$?
|
||||
if [ -n "$subdir" ]; then
|
||||
popd >/dev/null 2>&1
|
||||
fi
|
||||
return $result
|
||||
else
|
||||
__devspace_debug "Calling _describe"
|
||||
if eval _describe "completions" completions $flagPrefix $noSpace; then
|
||||
__devspace_debug "_describe found some completions"
|
||||
|
||||
# Return the success of having called _describe
|
||||
return 0
|
||||
else
|
||||
__devspace_debug "_describe did not find completions."
|
||||
__devspace_debug "Checking if we should do file completion."
|
||||
if [ $((directive & shellCompDirectiveNoFileComp)) -ne 0 ]; then
|
||||
__devspace_debug "deactivating file completion"
|
||||
|
||||
# We must return an error code here to let zsh know that there were no
|
||||
# completions found by _describe; this is what will trigger other
|
||||
# matching algorithms to attempt to find completions.
|
||||
# For example zsh can match letters in the middle of words.
|
||||
return 1
|
||||
else
|
||||
# Perform file completion
|
||||
__devspace_debug "Activating file completion"
|
||||
|
||||
# We must return the result of this command, so it must be the
|
||||
# last command, or else we must store its result to return it.
|
||||
_arguments '*:filename:_files'" ${flagPrefix}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# don't run the completion function when being source-ed or eval-ed
|
||||
if [ "$funcstack[1]" = "_devspace" ]; then
|
||||
_devspace
|
||||
fi
|
||||
|
||||
compdef _devspace devspace
|
||||
Reference in new issue
Block a user