add fish functions

This commit is contained in:
Gabriel Augendre 2025-01-19 10:54:07 +01:00
parent b3da68c630
commit 5271832a2c
No known key found for this signature in database
GPG key ID: 0073D1CD7EC5A253
14 changed files with 73 additions and 0 deletions

View file

@ -0,0 +1,3 @@
function code
open -a "Visual Studio Code" $argv
end

View file

@ -0,0 +1,5 @@
function corp
set creds (keepassxc-cli show -a username -a password ~/Nextcloud/OVH/keepass.kdbx corp)
set -g CORP_USER $creds[1]
set -g CORP_PWD $creds[2]
end

View file

@ -0,0 +1,26 @@
function fish_clipboard_copy
set -l cmdline
if isatty stdin
# Copy the current selection, or the entire commandline if that is empty.
# Don't use `string collect -N` here - `commandline` adds a newline.
set cmdline (commandline --current-selection | string collect)
test -n "$cmdline"; or set cmdline (commandline | string collect)
else
# Read from stdin
while read -lz line
set -a cmdline $line
end
end
if type -q pbcopy
printf '%s' $cmdline | pbcopy
else if set -q WAYLAND_DISPLAY; and type -q wl-copy
printf '%s' $cmdline | wl-copy
else if set -q DISPLAY; and type -q xsel
printf '%s' $cmdline | xsel --clipboard
else if set -q DISPLAY; and type -q xclip
printf '%s' $cmdline | xclip -selection clipboard
else if type -q clip.exe
printf '%s' $cmdline | clip.exe
end
end

View file

@ -0,0 +1,5 @@
function interne
set creds (keepassxc-cli show -a username -a password ~/Nextcloud/OVH/keepass.kdbx Interne)
set -U INTERNE_USER $creds[1]
set -U INTERNE_PWD $creds[2]
end

View file

@ -0,0 +1,3 @@
function k --wraps=kubectl --description 'alias k=kubectl'
kubectl $argv;
end

View file

@ -0,0 +1,3 @@
function kbash
kubectl bash $argv
end

View file

@ -0,0 +1,3 @@
function kctx --wraps='kubectl ctx'
kubectl ctx $argv;
end

View file

@ -0,0 +1,3 @@
function kdjango
kubectl django $argv
end

View file

@ -0,0 +1,6 @@
function kgetall
for i in (kubectl api-resources --verbs=list --namespaced -o name | grep -v "events.events.k8s.io" | grep -v "events" | sort | uniq)
echo -e "\nResource:" $i
kubectl get $i
end
end

View file

@ -0,0 +1,3 @@
function kgpg
killall gpg-agent;
end

View file

@ -0,0 +1,3 @@
function kjsonlogs
klogs $argv -o raw | jq -r -R 'fromjson? | select(type == "object") | "\(.timestamp) \(.level) \(.short_message)"'
end

View file

@ -0,0 +1,4 @@
# Defined interactively
function klogs --wraps="kubectl stern"
kubectl stern --tail=50 $argv
end

View file

@ -0,0 +1,3 @@
function kns --wraps='kubectl ns'
kubectl ns $argv;
end

View file

@ -0,0 +1,3 @@
function kpass
keepassxc-cli show -sa password ~/Nextcloud2/OVH/keepass.kdbx $argv
end