mirror of
https://github.com/Crocmagnon/dotfiles.git
synced 2025-01-22 05:13:56 +01:00
add fish functions
This commit is contained in:
parent
b3da68c630
commit
5271832a2c
14 changed files with 73 additions and 0 deletions
3
dot_config/fish/private_functions/code.fish
Normal file
3
dot_config/fish/private_functions/code.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
function code
|
||||
open -a "Visual Studio Code" $argv
|
||||
end
|
5
dot_config/fish/private_functions/corp.fish
Normal file
5
dot_config/fish/private_functions/corp.fish
Normal 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
|
26
dot_config/fish/private_functions/fish_clipboard_copy.fish
Normal file
26
dot_config/fish/private_functions/fish_clipboard_copy.fish
Normal 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
|
5
dot_config/fish/private_functions/interne.fish
Normal file
5
dot_config/fish/private_functions/interne.fish
Normal 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
|
3
dot_config/fish/private_functions/k.fish
Normal file
3
dot_config/fish/private_functions/k.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
function k --wraps=kubectl --description 'alias k=kubectl'
|
||||
kubectl $argv;
|
||||
end
|
3
dot_config/fish/private_functions/kbash.fish
Normal file
3
dot_config/fish/private_functions/kbash.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
function kbash
|
||||
kubectl bash $argv
|
||||
end
|
3
dot_config/fish/private_functions/kctx.fish
Normal file
3
dot_config/fish/private_functions/kctx.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
function kctx --wraps='kubectl ctx'
|
||||
kubectl ctx $argv;
|
||||
end
|
3
dot_config/fish/private_functions/kdjango.fish
Normal file
3
dot_config/fish/private_functions/kdjango.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
function kdjango
|
||||
kubectl django $argv
|
||||
end
|
6
dot_config/fish/private_functions/kgetall.fish
Normal file
6
dot_config/fish/private_functions/kgetall.fish
Normal 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
|
3
dot_config/fish/private_functions/kgpg.fish
Normal file
3
dot_config/fish/private_functions/kgpg.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
function kgpg
|
||||
killall gpg-agent;
|
||||
end
|
3
dot_config/fish/private_functions/kjsonlogs.fish
Normal file
3
dot_config/fish/private_functions/kjsonlogs.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
function kjsonlogs
|
||||
klogs $argv -o raw | jq -r -R 'fromjson? | select(type == "object") | "\(.timestamp) \(.level) \(.short_message)"'
|
||||
end
|
4
dot_config/fish/private_functions/klogs.fish
Normal file
4
dot_config/fish/private_functions/klogs.fish
Normal file
|
@ -0,0 +1,4 @@
|
|||
# Defined interactively
|
||||
function klogs --wraps="kubectl stern"
|
||||
kubectl stern --tail=50 $argv
|
||||
end
|
3
dot_config/fish/private_functions/kns.fish
Normal file
3
dot_config/fish/private_functions/kns.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
function kns --wraps='kubectl ns'
|
||||
kubectl ns $argv;
|
||||
end
|
3
dot_config/fish/private_functions/kpass.fish
Normal file
3
dot_config/fish/private_functions/kpass.fish
Normal file
|
@ -0,0 +1,3 @@
|
|||
function kpass
|
||||
keepassxc-cli show -sa password ~/Nextcloud2/OVH/keepass.kdbx $argv
|
||||
end
|
Loading…
Add table
Reference in a new issue