Dan Anglin
a909803b29
Reorganise and refactor the magefiles to make it more manageable and reduce duplication.
59 lines
1.4 KiB
Go Template
59 lines
1.4 KiB
Go Template
# If not running interactively, don't do anything
|
|
[[ $- != *i* ]] && return
|
|
|
|
# Environment section
|
|
|
|
## Session Paths - These will be added to PATH
|
|
{{- range $sessionPath := .BashProfile.SessionPaths -}}
|
|
{{- $fullPath := printf "%s/%s" (env "HOME") $sessionPath.Path -}}
|
|
{{ print "" }}
|
|
{{ print "" }}
|
|
### Add {{ $sessionPath.Description }} to PATH
|
|
if ! [[ "${PATH}" =~ {{ $fullPath }} ]]; then
|
|
export PATH={{ $fullPath}}:${PATH}
|
|
fi
|
|
{{- end -}}
|
|
{{ print "" }}
|
|
{{ print "" }}
|
|
## XDG Directories
|
|
{{ print "" }}
|
|
{{- range $key, $value := .BashProfile.XdgDirectories -}}
|
|
{{ print "" }}
|
|
export {{ $key }}="{{ $value }}"
|
|
{{- end -}}
|
|
{{ print "" }}
|
|
{{ print "" }}
|
|
## Extra Environment variables
|
|
{{ print "" }}
|
|
{{- range $key, $value := .BashProfile.EnvironmentVariables -}}
|
|
{{ print "" }}
|
|
export {{ $key }}="{{ $value }}"
|
|
{{- end -}}
|
|
{{ print "" }}
|
|
{{ print "" }}
|
|
# Aliases
|
|
{{ print "" }}
|
|
{{- range $key, $value := .BashProfile.Aliases -}}
|
|
{{ print "" }}
|
|
alias {{ $key }}="{{ $value }}"
|
|
{{- end -}}
|
|
{{ print "" }}
|
|
{{ print "" }}
|
|
# Bash Prompt
|
|
|
|
HOSTNAME_BG="$(tput setab 26)"
|
|
GREY_BG="$(tput setab 240)"
|
|
RESET="$(tput sgr0)"
|
|
FILEPATH_TC="$(tput setaf 81)"
|
|
WHITE_TC="$(tput setaf 255)"
|
|
PS1='${HOSTNAME_BG}${WHITE_TC}\033[1m \H ${GREY_BG} \u • ${FILEPATH_TC}\w ${RESET}\n\$ '
|
|
PS2=" -> "
|
|
|
|
# Commands
|
|
{{ print "" }}
|
|
{{- range $command := .BashProfile.Commands -}}
|
|
{{ print "" }}
|
|
## {{ $command.Description }}
|
|
{{ $command.Command }}
|
|
{{- end -}}
|
|
{{ print "" }}
|