mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
Merge pull request #191 from nmarghetti/master
Add quote around path to handle case with space in $HOME or $OSH
This commit is contained in:
22
.github/workflows/test.sh
vendored
Normal file
22
.github/workflows/test.sh
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
tmpdir=$(mktemp -d)
|
||||||
|
|
||||||
|
export OSH="$tmpdir/path with space"
|
||||||
|
export HOME="$tmpdir/home with space"
|
||||||
|
mkdir -p "$HOME"
|
||||||
|
|
||||||
|
OSH_REPOSITORY="$PWD" ./tools/install.sh
|
||||||
|
|
||||||
|
source "$HOME/.bashrc"
|
||||||
|
|
||||||
|
set | grep -aE "^OSH"
|
||||||
|
|
||||||
|
if [[ "$OSH_THEME" == "font" ]]; then
|
||||||
|
echo "Installation succeeded"
|
||||||
|
else
|
||||||
|
echo "Installation failed, \$OSH_THEME is not set to 'font'"
|
||||||
|
exit 1
|
||||||
|
fi
|
28
.github/workflows/test.yml
vendored
Normal file
28
.github/workflows/test.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
# ubuntu-20.04 available: https://github.com/actions/virtual-environments/issues/1816
|
||||||
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
submodules: false
|
||||||
|
- name: Upgrade bash on Mac
|
||||||
|
if: runner.os == 'macOs'
|
||||||
|
run: brew install bash
|
||||||
|
- name: Install oh-my-bash
|
||||||
|
shell: bash
|
||||||
|
run: bash --noprofile --norc -i "$PWD/.github/workflows/test.sh"
|
@ -48,7 +48,7 @@ bind '"\e[C": forward-char'
|
|||||||
bind '"\e[D": backward-char'
|
bind '"\e[D": backward-char'
|
||||||
|
|
||||||
# Use standard ISO 8601 timestamp
|
# Use standard ISO 8601 timestamp
|
||||||
# %F equivalent to %Y-%m-%d
|
# %F equivalent to %Y-%m-%d
|
||||||
# %T equivalent to %H:%M:%S (24-hours format)
|
# %T equivalent to %H:%M:%S (24-hours format)
|
||||||
|
|
||||||
# Show history
|
# Show history
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
if [ ! -n "$SDIRS" ]; then
|
if [ ! -n "$SDIRS" ]; then
|
||||||
SDIRS=~/.sdirs
|
SDIRS=~/.sdirs
|
||||||
fi
|
fi
|
||||||
touch $SDIRS
|
touch "$SDIRS"
|
||||||
|
|
||||||
# main function
|
# main function
|
||||||
function bm {
|
function bm {
|
||||||
|
@ -152,7 +152,7 @@ ___brainy_prompt_clock() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
___brainy_prompt_battery() {
|
___brainy_prompt_battery() {
|
||||||
[ ! -e $OSH/plugins/battery/battery.plugin.sh ] ||
|
[ ! -e "$OSH/plugins/battery/battery.plugin.sh" ] ||
|
||||||
[ "${THEME_SHOW_BATTERY}" != "true" ] && return
|
[ "${THEME_SHOW_BATTERY}" != "true" ] && return
|
||||||
info=$(battery_percentage)
|
info=$(battery_percentage)
|
||||||
color=$_omb_prompt_bold_green
|
color=$_omb_prompt_bold_green
|
||||||
|
@ -137,7 +137,7 @@ _omb_install_user_bashrc() {
|
|||||||
printf "${BLUE}Using the Oh My Bash template file and adding it to ~/.bashrc${NORMAL}\n"
|
printf "${BLUE}Using the Oh My Bash template file and adding it to ~/.bashrc${NORMAL}\n"
|
||||||
_omb_install_run cp "$OSH"/templates/bashrc.osh-template ~/.bashrc
|
_omb_install_run cp "$OSH"/templates/bashrc.osh-template ~/.bashrc
|
||||||
sed "/^export OSH=/ c\\
|
sed "/^export OSH=/ c\\
|
||||||
export OSH=$OSH
|
export OSH='${OSH//\'/\'\\\'\'}'
|
||||||
" ~/.bashrc >| ~/.bashrc.omb-temp
|
" ~/.bashrc >| ~/.bashrc.omb-temp
|
||||||
_omb_install_run mv -f ~/.bashrc.omb-temp ~/.bashrc
|
_omb_install_run mv -f ~/.bashrc.omb-temp ~/.bashrc
|
||||||
|
|
||||||
@ -230,6 +230,10 @@ _omb_install_main() {
|
|||||||
OSH=~/.oh-my-bash
|
OSH=~/.oh-my-bash
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! $OSH_REPOSITORY ]]; then
|
||||||
|
OSH_REPOSITORY=https://github.com/ohmybash/oh-my-bash.git
|
||||||
|
fi
|
||||||
|
|
||||||
# Only enable exit-on-error after the non-critical colorization stuff,
|
# Only enable exit-on-error after the non-critical colorization stuff,
|
||||||
# which may fail on systems lacking tput or terminfo
|
# which may fail on systems lacking tput or terminfo
|
||||||
|
|
||||||
@ -261,7 +265,7 @@ _omb_install_main() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
_omb_install_run git clone --depth=1 https://github.com/ohmybash/oh-my-bash.git "$OSH" || {
|
_omb_install_run git clone --depth=1 "$OSH_REPOSITORY" "$OSH" || {
|
||||||
printf "Error: git clone of oh-my-bash repo failed\n"
|
printf "Error: git clone of oh-my-bash repo failed\n"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user