Skip to content

Commit 8b5d82f

Browse files
committed
style(direnv): improve string quoting and regex patterns
- Add word boundaries to URL regex patterns for more precise matching - Standardize on single quotes for string literals throughout the file - Maintain consistent quoting style in sed commands and file paths
1 parent bc2af86 commit 8b5d82f

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

template/.config/copier/direnv/10-python.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ pushd "$(git rev-parse --show-toplevel)" > /dev/null || return 1
77
function replace-mirrors() {
88
local file="$1"
99
if [[ -f $file ]]; then
10-
sd 'https://(\S+)/simple' 'https://pypi.org/simple' "$file"
11-
sd 'https://(\S+)/packages' 'https://files.pythonhosted.org/packages' "$file"
10+
sd 'https://(\S+)/simple\b' 'https://pypi.org/simple' "$file"
11+
sd 'https://(\S+)/packages\b' 'https://files.pythonhosted.org/packages' "$file"
1212
fi
1313
}
1414

15-
if [[ -f "pixi.lock" ]]; then
15+
if [[ -f 'pixi.lock' ]]; then
1616
options=()
1717
if [[ -t 2 ]]; then
1818
options+=(--color=always)
@@ -21,13 +21,13 @@ if [[ -f "pixi.lock" ]]; then
2121
replace-mirrors 'pixi.lock'
2222
fi
2323

24-
if [[ -f "uv.lock" ]]; then
24+
if [[ -f 'uv.lock' ]]; then
2525
uv sync --all-extras --all-groups
2626
replace-mirrors 'uv.lock'
2727
sed --in-place --regexp-extended \
28-
"s|\s*(include-system-site-packages)\s*=\s*.*\s*|\1 = true|" ".venv/pyvenv.cfg"
28+
's|\s*(include-system-site-packages)\s*=\s*.*\s*|\1 = true|' '.venv/pyvenv.cfg'
2929
# shellcheck disable=SC1091
30-
source ".venv/bin/activate"
30+
source '.venv/bin/activate'
3131
fi
3232

3333
popd > /dev/null || return 1

0 commit comments

Comments
 (0)