Skip to content

Commit

Permalink
Add aws-profile zsh function
Browse files Browse the repository at this point in the history
  • Loading branch information
containerscrew committed Sep 16, 2024
1 parent d8b3f8e commit 7813c87
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ repos:
- id: check-merge-conflict
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/thlorenz/doctoc
rev: v2.2.0
hooks:
- id: doctoc
- repo: https://github.com/gitleaks/gitleaks
rev: v8.16.1
hooks:
- id: gitleaks
- repo: https://github.com/containerscrew/mtoc
rev: v0.3.2
hooks:
- id: mtoc
args: []
12 changes: 12 additions & 0 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,15 @@ alias kns='kubens'

# FZF
source <(fzf --zsh)

# Custom functions
function aws-profile() {
local AWS_PROFILES
AWS_PROFILES=$(cat ~/.aws/credentials | sed -n -e 's/^\[\(.*\)\]/\1/p' | fzf)
if [[ -n "$AWS_PROFILES" ]]; then
export AWS_PROFILE=$AWS_PROFILES
echo "Selected profile: $AWS_PROFILES"
else
echo "No profile selected"
fi
}

0 comments on commit 7813c87

Please sign in to comment.