Browse Source

[fish] Update functions from sure

Colin Powell 1 year ago
parent
commit
f289250a4d

+ 3 - 0
fish/.config/fish/functions/al.fish

@@ -0,0 +1,3 @@
+function al
+    aws sso login --profile $argv
+end

+ 5 - 0
fish/.config/fish/functions/dnsupdate.fish

@@ -0,0 +1,5 @@
+function dnsupdate
+  for arg in $argv
+    curl -X PUT  "https://box.unbl.ink/admin/dns/custom/$arg.unbl.ink" --user colin@unbl.ink:$(pass personal/colin@unbl.ink)
+  end
+end

+ 3 - 0
fish/.config/fish/functions/k.fish

@@ -0,0 +1,3 @@
+function k
+  kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash -c "python manage.py shell" 
+end

+ 4 - 0
fish/.config/fish/functions/kc.fish

@@ -0,0 +1,4 @@
+function kc
+  echo "from platform_core.apps.core_protections.models import *" | pbcopy
+  kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash -c "python manage.py shell" 
+end

+ 28 - 0
fish/.config/fish/functions/kush.fish

@@ -0,0 +1,28 @@
+function kush
+
+  switch $argv[1]
+    case "sbx"
+      aws eks update-kubeconfig --name surepreme-sandbox-main-cluster --profile sure-inc
+    case "qa"
+      aws eks update-kubeconfig --name farmers-qa-main-cluster --profile np-farmers
+    case "prod"
+      echo "from platform_core.apps.core_protections.models import *" | pbcopy
+      aws eks update-kubeconfig --name surepreme-production-main-cluster --profile sure-inc
+      kubectl exec -it -n bastion $(kubectl get po -n bastion | grep "surepreme.*bastion" | head -n 1 | awk '{print $1}') -- python manage.py shell
+  end
+
+  if test (count $argv) -gt 1
+    if [ $argv[2] = "-p" ]
+      echo "Import command is on your clipboard"
+      echo "from platform_core.apps.core_protections.models import *" | pbcopy
+      kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash -c "python manage.py shell"
+    else
+      kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
+    end
+  else
+    kubectl exec -it $(kubectl get pods | fzf | awk '{print $1}'|head -n 1) -- bash
+  end
+
+
+
+end

+ 3 - 0
fish/.config/fish/functions/pt.fish

@@ -0,0 +1,3 @@
+function pt
+poetry run pytest $argv
+end

+ 3 - 1
fish/.config/fish/functions/sure-npm-token

@@ -1 +1,3 @@
-aws codeartifact login --namespace sureapp --tool npm --repository npm --domain sure --domain-owner 348777858795 --profile $AWS_PROFILE
+function sure-npm-token
+    aws codeartifact login --namespace sureapp --tool npm --repository npm --domain sure --domain-owner 348777858795 --profile $argv
+end

+ 3 - 1
fish/.config/fish/functions/sure-npm-token.fish

@@ -1 +1,3 @@
-aws codeartifact login --namespace sureapp --tool npm --repository npm --domain sure --domain-owner 348777858795 --profile $AWS_PROFILE
+function sure-npm-token
+    aws codeartifact login --namespace sureapp --tool npm --repository npm --domain sure --domain-owner 348777858795 --profile $argv
+end

+ 3 - 1
fish/.config/fish/functions/sure-set-token.fish

@@ -1,4 +1,6 @@
 function sure-set-token
-  set -x PRIVATE_REPO_TOKEN "$(aws codeartifact get-authorization-token --domain sure --query authorizationToken --output text --profile registries-read)"
+  set -Ux PRIVATE_REPO_TOKEN "$(aws codeartifact get-authorization-token --domain sure --query authorizationToken --output text --profile registries-read)"
+  set -Ux CODEARTIFACT_AUTH_TOKEN "$PRIVATE_REPO_TOKEN"
   poetry config http-basic.codeartifact aws $PRIVATE_REPO_TOKEN
+  aws codeartifact login --namespace sureapp --tool npm --repository npm --domain sure --domain-owner 348777858795 --profile registries-read
 end

+ 3 - 0
fish/.config/fish/functions/v.fish

@@ -0,0 +1,3 @@
+function v
+  fzf --bind 'enter:become(vim {})'
+end