Integrate aws-switch-profile with vterm and set a default profile

This commit is contained in:
Jeremy Dormitzer 2021-02-22 22:54:32 -05:00
parent 4ba3408c03
commit 2c95b17866

View File

@ -13,16 +13,22 @@
(add-hook 'vterm-mode-hook #'aws-local-profile)
(add-hook 'term-mode-hook #'aws-local-profile)
(setq aws-current-profile (getenv "AWS_PROFILE"))
(add-to-list 'aws-profiles "personal")
(add-to-list 'aws-profiles "lola-cde")
(defun aws-switch-profile (profile)
(interactive (list (completing-read "Profile: " aws-profiles)))
(setenv "AWS_PROFILE" profile)
(when (eq major-mode 'vterm-mode)
(vterm-send-C-e)
(vterm-send-C-u)
(vterm-send-string (format "export AWS_PROFILE=%s\n" profile)))
(setq aws-current-profile profile))
(add-hook 'emacs-startup-hook
(lambda ()
(aws-switch-profile "default")))
;; A command to MFA to AWS
(defun aws-mfa (mfa-token)
(interactive (list