Skip to content

Commit

Permalink
condition aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
mtaron committed Apr 26, 2024
1 parent 1d00b96 commit 2fd0122
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 13 deletions.
31 changes: 21 additions & 10 deletions home/private_dot_config/private_zsh/zsh.d/aliases.zsh.tmpl
Original file line number Diff line number Diff line change
@@ -1,24 +1,35 @@
# Update OS dependencies
# update OS dependencies
alias up='sudo apt update && sudo apt -V --yes upgrade'

# Remove untracked files and directories
# run sudo with the current PATH environment variable
alias psudo='sudo env "PATH=$PATH"'

# activate a python virtual environment
alias activate='source .venv/bin/activate'

# remove untracked files and directories
alias clean='git clean --force -X -d'

{{ if lookPath "aws" -}}
alias cf='aws cloudformation'
{{- end }}

{{ if lookPath "code" -}}
alias c='code .'
alias dotfiles-edit='code $XDG_DATA_HOME/chezmoi'
{{- end }}

{{ if lookPath "kubectl" -}}
alias k='kubectl'
alias kl='kubectl logs --follow'
{{- end }}

alias dotfiles='code $XDG_DATA_HOME/chezmoi'

alias activate='source .venv/bin/activate'

alias psudo='sudo env "PATH=$PATH"'

{{ if lookPath "rg" -}}
alias rgf='rg --files | rg'
{{- end }}

{{- if and (lookPath "chezmoi") (lookPath "gh") }}
alias chezmoi='GITHUB_TOKEN=$(gh auth token -h github.com 2>/dev/null) chezmoi'
{{ if and (lookPath "chezmoi") (lookPath "gh") -}}
# launch chezmoi with a GitHub token, increasing the rate limit on GitHub APIs
# https://www.chezmoi.io/reference/templates/github-functions/
alias chezmoi-gh='GITHUB_TOKEN=$(gh auth token -h github.com 2>/dev/null) chezmoi'
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
reset-shell()
dotfiles-reset()
{
chezmoi apply
zgenom reset
exec zsh
}

update-shell()
dotfiles-update()
{
zgenom update
chezmoi update
zgenom update
exec zsh
}

0 comments on commit 2fd0122

Please sign in to comment.