Skip to content

Commit 8fbf338

Browse files
committed
paths fiddling
1 parent 78dc6a4 commit 8fbf338

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

.bash_profile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@
22

33
# PATH setup via ~/.paths
44
setupPATH() {
5-
# Credit to https://github.com/davidaurelio/dotfiles/blob/main/.profile for the technique
5+
# Credit to https://github.com/davidaurelio/dotfiles/blob/main/.profile this cute pattern.
66
while read -r P; do
77
P=`eval echo $P`
88
if [ -d "$P" ]; then
9-
# echo "okay $P"
109
export PATH="$PATH:$P"
1110
fi
1211
# read these files but strip out comments and newlines.
13-
done < <(cat ~/.paths ~/.paths.local 2> /dev/null | grep -v "^#")
12+
done < <(tac ~/.paths ~/.paths.local 2> /dev/null | sed 's|#.*||')
1413
}
1514
setupPATH;
1615

fish/chromium.fish

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ end
207207

208208

209209
# dt. rpp
210-
alias rppunit 'npm test -- --skip-ninja front_end/panels/timeline/ front_end/models/trace front_end/ui/legacy/components/perf_ui front_end/models/cpu_profile front_end/services/trace_bounds'
210+
alias rppunit 'npm test -- --skip-ninja front_end/panels/timeline/ front_end/models/trace front_end/ui/legacy/components/perf_ui front_end/models/cpu_profile front_end/services/trace_bounds front_end/models/ai_assistance/'
211211
alias rppunit-debug 'npm test -- front_end/panels/timeline/ front_end/models/trace front_end/ui/legacy/components/perf_ui --debug'
212212
alias rppinter 'npm run test -- test/e2e/performance/'
213213
alias rppe2e 'npm run test -- test/e2e/performance/'
@@ -255,6 +255,8 @@ end
255255
alias upload 'git cl format --js && git status --porcelain=v2 && git cl upload'
256256

257257
abbr gcert 'gcert-local'
258+
# copy a diff-looking thing (like our karma diffs) to clipboard and this'll run em through delta. Could be improved for multiline strings but.. requires lotta lines.
259+
abbr deltapb 'printf "%s\n" "@@ -1,1 +1,1 @@" (pbpaste) | delta --max-line-length 1024 --minus-style "white #2b0000" --plus-style "white #001900"'
258260

259261
function clstatus --description "pick a branch that is on gerrit as a CL"
260262
set -l branch_name (git cl status --no-branch-color --date-order | awk '/ : / {print $0}' | fzf | awk '{print $1}')

fish/functions.fish

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# thx to https://github.com/mduvall/config/
21

32
function subl --description 'Open Sublime Text'
43
if test -d "/Applications/Sublime Text.app"
@@ -87,10 +86,10 @@ end
8786

8887
function all_binaries_in_path --description \
8988
"list all binaries available in \$PATH (incl conflicts). pipe it to grep. top-most are what's used, in case of conflicts"
90-
# based on https://unix.stackexchange.com/a/120790/110766 but tweaked to work on mac. and then made it faster.
91-
find -L $PATH -maxdepth 1 -executable -type f 2>/dev/null
89+
# based on https://unix.stackexchange.com/a/120790/110766. and then made it faster. needs `brew install findutils`
90+
gfind -L $PATH -maxdepth 1 -executable -type f 2>/dev/null
9291

93-
# list path
92+
# to list path. topmost wins.
9493
# for val in $PATH; echo "$val"; end
9594
end
9695

fish/path.fish

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11

22

3-
# Read from ~/.paths and populate PATH based on that.
4-
for line in (string split -n "\n" < ~/.paths)
3+
# Read from ~/.paths and populate PATH based on that. reversed to ensure priority goes to top of file.
4+
for line in (tac ~/.paths | sed 's|#.*||' | string split -n "\n")
55
# skip comments
66
if test (string sub --length 1 "$line") = "#"
77
continue
88
end
9-
# testing first (if test -d "$line" -o -L "$line") seems nice but excludes some important thigns
109

11-
# --global works like normal PATH additions in bash. but default is --universal which seems like more fun. maybe try that out
12-
fish_add_path --global "$line"
10+
set expanded_line (string replace '$HOME' "$HOME" (string replace '~' "$HOME" "$line"))
11+
12+
# Hmm.. I previously said this existence check excludes some important things but now i'm not sure.
13+
if test -d "$expanded_line" -o -L "$expanded_line"
14+
# --global works like normal PATH additions in bash. but default is --universal which seems like more fun. maybe try that out
15+
fish_add_path --global "$expanded_line"
16+
else
17+
# echo "Warning: Path '$expanded_line' does not exist or is not a directory/symlink. Skipping." >&2
18+
end
1319
end

0 commit comments

Comments
 (0)