Update aws integration
This commit is contained in:
parent
c99cf97d63
commit
26c1c7d025
@ -13,12 +13,14 @@
|
|||||||
(add-hook 'vterm-mode-hook #'aws-local-profile)
|
(add-hook 'vterm-mode-hook #'aws-local-profile)
|
||||||
(add-hook 'term-mode-hook #'aws-local-profile)
|
(add-hook 'term-mode-hook #'aws-local-profile)
|
||||||
|
|
||||||
(add-to-list 'aws-profiles "personal")
|
(defun aws-list-profiles ()
|
||||||
(add-to-list 'aws-profiles "lola-cde")
|
(when (not (executable-find "aws"))
|
||||||
(add-to-list 'aws-profiles "lola-gbt")
|
(user-error "Unable to find executable \"aws\"!"))
|
||||||
|
(let ((profile-string (shell-command-to-string "aws configure list-profiles")))
|
||||||
|
(s-split "\n" profile-string)))
|
||||||
|
|
||||||
(defun aws-switch-profile (profile)
|
(defun aws-switch-profile (profile)
|
||||||
(interactive (list (completing-read "Profile: " aws-profiles)))
|
(interactive (list (completing-read "Profile: " (aws-list-profiles))))
|
||||||
(setenv "AWS_PROFILE" profile)
|
(setenv "AWS_PROFILE" profile)
|
||||||
(when (eq major-mode 'vterm-mode)
|
(when (eq major-mode 'vterm-mode)
|
||||||
(vterm-send-C-e)
|
(vterm-send-C-e)
|
||||||
@ -26,6 +28,10 @@
|
|||||||
(vterm-send-string (format "export AWS_PROFILE=%s\n" profile)))
|
(vterm-send-string (format "export AWS_PROFILE=%s\n" profile)))
|
||||||
(setq aws-current-profile profile))
|
(setq aws-current-profile profile))
|
||||||
|
|
||||||
|
(defun aws-sso-login ()
|
||||||
|
(interactive)
|
||||||
|
(async-shell-command "AWS_PROFILE=default aws sso login"))
|
||||||
|
|
||||||
(add-hook 'emacs-startup-hook
|
(add-hook 'emacs-startup-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(aws-switch-profile "default")))
|
(aws-switch-profile "default")))
|
||||||
|
Loading…
Reference in New Issue
Block a user