refactor: modular .bashrc.d/ structure
- Rewrite .bashrc as minimal loader (34 lines → loads .bashrc.d/*.sh)
- Clean .bash_profile: single source, Apple Silicon/Intel brew path
- Add .bashrc.d/ with 7 topic modules:
00_env.sh PS1, OSTYPE, colors, pyenv
10_aliases.sh universal aliases
20_functions.sh proxy, dbash, git helpers
30_work.sh work-host detection, LDAP, AWX, Juniper tools
(+ unified-hub-login with env-var creds)
40_k8s.sh kubectl completion + aliases
50_ai_env.sh WORKSPACE/DATA_ROOT/MODEL_ROOT paths
60_dotfiles.sh dotfiles manager aliases, zet shortcuts
- Secrets (SN_PASSWORD, LDAP bind PWs, Unified Hub token) moved
to ~/.bashrc.local (gitignored, written by setup script)
- Update .dotfiles_manifest to track .bashrc.d directory
This commit is contained in:
68
.bashrc.d/00_env.sh
Normal file
68
.bashrc.d/00_env.sh
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
# 00_env.sh — Core environment: prompt, editor, OS detection, terminal colors
|
||||
# Shared across all machines. No secrets. No machine-specific paths.
|
||||
# ============================================================================
|
||||
|
||||
export PS1='\h:\w\$ '
|
||||
export PS2='> '
|
||||
export FTP_PASSIVE_MODE=YES
|
||||
export RSYNC_RSH=ssh
|
||||
|
||||
# Use short hostname consistently (macOS and Linux)
|
||||
HOSTNAME=$(hostname -s)
|
||||
HOSTDOMAIN=$(hostname -d 2>/dev/null || true)
|
||||
export HOSTNAME HOSTDOMAIN
|
||||
|
||||
EDITOR=vim
|
||||
export EDITOR
|
||||
set -o vi
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# OS-specific
|
||||
# -----------------------------------------------------------------------
|
||||
_OSTYPE=$(uname -s)
|
||||
|
||||
case $_OSTYPE in
|
||||
Linux)
|
||||
alias ls='ls -F'
|
||||
alias pst='ps axjf'
|
||||
if type "$EDITOR" >/dev/null 2>&1; then
|
||||
alias vi="${EDITOR}"
|
||||
else
|
||||
EDITOR=vi
|
||||
fi
|
||||
export PAGER=$(type less >/dev/null 2>&1 && echo less || echo more)
|
||||
|
||||
function yaml2json {
|
||||
python -c 'import sys, yaml, json; print(json.dumps(yaml.safe_load(sys.stdin.read())))'
|
||||
}
|
||||
;;
|
||||
Darwin)
|
||||
alias pst='pstree'
|
||||
export CLICOLOR=1
|
||||
export DOCKER_DEFAULT_PLATFORM=linux/amd64
|
||||
export BASH_SILENCE_DEPRECATION_WARNING=1
|
||||
|
||||
# pyenv — only init if installed
|
||||
if command -v pyenv >/dev/null 2>&1; then
|
||||
export PYENV_ROOT="$HOME/.pyenv"
|
||||
export PATH="$PYENV_ROOT/bin:$PATH"
|
||||
eval "$(pyenv init --path)"
|
||||
eval "$(pyenv init -)"
|
||||
fi
|
||||
;;
|
||||
FreeBSD)
|
||||
export CLICOLOR=1
|
||||
export LSCOLORS=fxgxcxdxbxegedabagacad
|
||||
;;
|
||||
esac
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# Terminal-specific
|
||||
# -----------------------------------------------------------------------
|
||||
case $TERM in
|
||||
xterm*)
|
||||
export LS_COLORS='no=00:fi=00:di=00;35:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;31:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:*.pl=00;32:'
|
||||
alias ls='ls -F --color'
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user