-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_bash_aliases
More file actions
94 lines (84 loc) · 3.36 KB
/
Copy pathdot_bash_aliases
File metadata and controls
94 lines (84 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Basic
alias ll='ls -alF'
alias la='ls -A'
alias vi='vim'
# Git
alias gs='git status'
alias gb='git branch'
alias gl='git log --oneline --graph'
alias gd='git diff'
alias gc='git commit'
alias gp='git push'
# Build tools
alias cm='cmake -GNinja'
alias mk='ninja -C build'
alias cb='cd ~/cubrid'
# AI
# Always launch Claude Code inside a tmux session.
# - If already inside tmux ($TMUX set), run claude in-place.
# - If stdout is not a TTY (piped/non-interactive), skip the tmux wrap.
# - Otherwise spawn a fresh tmux session named after the last 2 path components.
claude() {
if [ -n "$TMUX" ] || [ ! -t 1 ]; then
command claude --dangerously-skip-permissions "$@"
return $?
fi
# tmux session names disallow '.' and ':' — slugify last 2 path components.
local dir_tail dir_slug
dir_tail=$(printf %s "$PWD" | awk -F/ '{n=NF; a=(n>1?$(n-1):""); b=$n; print (a==""?b:a"-"b)}')
dir_slug=$(printf %s "$dir_tail" | tr -c '[:alnum:]_-' '-' | sed 's/-\{2,\}/-/g; s/^-//; s/-$//')
[ -z "$dir_slug" ] && dir_slug="root"
local session="claude-${dir_slug}-$$"
local args
args=$(printf '%q ' "$@")
tmux new-session -s "$session" "command claude --dangerously-skip-permissions $args"
}
# Python
alias py='python3'
# Rust
alias rr='cargo run'
alias rb='cargo build'
alias rt='cargo test'
alias rc='cargo check'
alias ru='cargo update'
alias ra='cargo audit'
alias ex='cargo expand'
# CUBRID environment switcher
# Usage: use-cubrid [root_dir] [install_subdir]
# root_dir — root of the CUBRID source tree (default: ~/cubrid)
# install_subdir — install directory name inside root (default: install.out)
# Examples:
# use-cubrid → ~/cubrid/install.out
# use-cubrid ~/cubrid-12 → ~/cubrid-12/install.out
# use-cubrid ~/cubrid-12 build.out → ~/cubrid-12/build.out
# Safe to call multiple times — strips previous CUBRID entries before setting new ones.
use-cubrid() {
local cubrid_root="${1:-$HOME/cubrid}"
local install_subdir="${2:-install.out}"
local cubrid_path="$cubrid_root/$install_subdir"
if [ ! -d "$cubrid_path" ]; then
echo "Error: CUBRID install dir does not exist: $cubrid_path" >&2
return 1
fi
# Strip any existing CUBRID entries from PATH and LD_LIBRARY_PATH
# to prevent accumulation when switching between versions.
# Uses -F (fixed-string) to avoid regex metacharacter issues in paths.
if [ -n "${CUBRID:-}" ]; then
PATH=$(echo "$PATH" | tr ':' '\n' | grep -Fv "$CUBRID" | paste -sd ':' || true)
LD_LIBRARY_PATH=$(echo "${LD_LIBRARY_PATH:-}" | tr ':' '\n' | grep -Fv "$CUBRID" | paste -sd ':' || true)
# Ensure we don't end up with an empty PATH which would expose CWD
PATH="${PATH:-/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin}"
fi
export CUBRID="$cubrid_path"
export CUBRID_DATABASES="$CUBRID/databases"
export LD_LIBRARY_PATH="$CUBRID/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
export PATH="$CUBRID/bin:$PATH"
echo "CUBRID environment set to: $CUBRID"
}
# --- Claude Code 계정 프로필 전환 (added 2026-06-01) ---
# 기본 계정(현재): ~/.claude | cubrid 계정: ~/.claude-cubrid
alias claude-main='CLAUDE_CONFIG_DIR=$HOME/.claude claude'
alias claude-cubrid='CLAUDE_CONFIG_DIR=$HOME/.claude-cubrid claude'
# 짧은 별칭: cl → 기본 claude, clc → cubrid 프로필
alias cl='claude'
alias clc='CLAUDE_CONFIG_DIR=$HOME/.claude-cubrid claude'