Skip to content

Commit

Permalink
Rename variables
Browse files Browse the repository at this point in the history
  • Loading branch information
suzaku committed Dec 2, 2020
1 parent 965283f commit 17a27ca
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
16 changes: 8 additions & 8 deletions scripts/shonenjump.bash
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
export AUTOJUMP_SOURCED=1
export SHONENJUMP_SOURCED=1

# set error file location
if [[ "$(uname)" == "Darwin" ]]; then
export AUTOJUMP_ERROR_PATH=~/Library/shonenjump/errors.log
export SHONENJUMP_ERROR_PATH=~/Library/shonenjump/errors.log
elif [[ -n "${XDG_DATA_HOME}" ]]; then
export AUTOJUMP_ERROR_PATH="${XDG_DATA_HOME}/shonenjump/errors.log"
export SHONENJUMP_ERROR_PATH="${XDG_DATA_HOME}/shonenjump/errors.log"
else
export AUTOJUMP_ERROR_PATH=~/.local/share/shonenjump/errors.log
export SHONENJUMP_ERROR_PATH=~/.local/share/shonenjump/errors.log
fi

if [[ ! -d "$(dirname ${AUTOJUMP_ERROR_PATH})" ]]; then
mkdir -p "$(dirname ${AUTOJUMP_ERROR_PATH})"
if [[ ! -d "$(dirname ${SHONENJUMP_ERROR_PATH})" ]]; then
mkdir -p "$(dirname ${SHONENJUMP_ERROR_PATH})"
fi


Expand All @@ -30,8 +30,8 @@ complete -F _shonenjump j

# change pwd hook
shonenjump_add_to_database() {
if [[ -f "${AUTOJUMP_ERROR_PATH}" ]]; then
(shonenjump --add "$(pwd)" >/dev/null 2>>${AUTOJUMP_ERROR_PATH} &) &>/dev/null
if [[ -f "${SHONENJUMP_ERROR_PATH}" ]]; then
(shonenjump --add "$(pwd)" >/dev/null 2>>${SHONENJUMP_ERROR_PATH} &) &>/dev/null
else
(shonenjump --add "$(pwd)" >/dev/null &) &>/dev/null
fi
Expand Down
14 changes: 7 additions & 7 deletions scripts/shonenjump.fish
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set -gx AUTOJUMP_SOURCED 1
set -gx SHONENJUMP_SOURCED 1

# Set ostype, if not set
if not set -q OSTYPE
Expand All @@ -7,22 +7,22 @@ end

# set error file location
if test (uname) = "Darwin"
set -gx AUTOJUMP_ERROR_PATH ~/Library/shonenjump/errors.log
set -gx SHONENJUMP_ERROR_PATH ~/Library/shonenjump/errors.log
else if test -d "$XDG_DATA_HOME"
set -gx AUTOJUMP_ERROR_PATH $XDG_DATA_HOME/shonenjump/errors.log
set -gx SHONENJUMP_ERROR_PATH $XDG_DATA_HOME/shonenjump/errors.log
else
set -gx AUTOJUMP_ERROR_PATH ~/.local/share/shonenjump/errors.log
set -gx SHONENJUMP_ERROR_PATH ~/.local/share/shonenjump/errors.log
end

if test ! -d (dirname $AUTOJUMP_ERROR_PATH)
mkdir -p (dirname $AUTOJUMP_ERROR_PATH)
if test ! -d (dirname $SHONENJUMP_ERROR_PATH)
mkdir -p (dirname $SHONENJUMP_ERROR_PATH)
end


# change pwd hook
function __aj_add --on-variable PWD
status --is-command-substitution; and return
shonenjump --add (pwd) >/dev/null 2>>$AUTOJUMP_ERROR_PATH &
shonenjump --add (pwd) >/dev/null 2>>$SHONENJUMP_ERROR_PATH &
end


Expand Down
4 changes: 2 additions & 2 deletions scripts/shonenjump.zsh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# change pwd hook
shonenjump_chpwd() {
if [[ -f "${AUTOJUMP_ERROR_PATH}" ]]; then
shonenjump --add "$(pwd)" >/dev/null 2>>${AUTOJUMP_ERROR_PATH} &!
if [[ -f "${SHONENJUMP_ERROR_PATH}" ]]; then
shonenjump --add "$(pwd)" >/dev/null 2>>${SHONENJUMP_ERROR_PATH} &!
else
shonenjump --add "$(pwd)" >/dev/null &!
fi
Expand Down

0 comments on commit 17a27ca

Please sign in to comment.