! Rename XDG_CACHE_LOCATION to XDG_HISTORY_LOCATION
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Gives closer adherence to actual content for the environment variable.
This commit is contained in:
parent
525a379564
commit
31dea58782
5 changed files with 18 additions and 17 deletions
|
@ -14,11 +14,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- Multiple command options can be combined
|
- Multiple command options can be combined
|
||||||
- History uses `XDG_STATE_HOME` directory by default:
|
- (!) History uses `XDG_STATE_HOME` directory by default:
|
||||||
This constitutes a slight break in behavior if you relied a lot on your pick history in the
|
This constitutes a break in behavior if you relied a lot on your pick history in the default
|
||||||
default location. To retain your old history file, simply move it from the old cache directory
|
location. To retain your old history file, simply move it from the old cache directory
|
||||||
(`~/.cache/bemoji-history.txt` by default) to the new one (`~/.local/state/bemoji-history.txt`
|
(`~/.cache/bemoji-history.txt` by default) to the new one (`~/.local/state/bemoji-history.txt`
|
||||||
by default).
|
by default).
|
||||||
|
- (!) `XDG_CACHE_LOCATION` renamed to `XDG_HISTORY_LOCATION` to better signify its purpose
|
||||||
|
|
||||||
<!-- ### Deprecated -->
|
<!-- ### Deprecated -->
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,7 @@ You can overwrite the directories bemoji uses for its emoji lists and history fi
|
||||||
|
|
||||||
```
|
```
|
||||||
BEMOJI_DB_LOCATION=/path/to/my/emoji/directory
|
BEMOJI_DB_LOCATION=/path/to/my/emoji/directory
|
||||||
BEMOJI_CACHE_LOCATION=/path/to/my/state/directory
|
BEMOJI_HISTORY_LOCATION=/path/to/my/state/directory
|
||||||
```
|
```
|
||||||
|
|
||||||
There are no equivalent commandline arguments to overwrite these two settings.
|
There are no equivalent commandline arguments to overwrite these two settings.
|
||||||
|
@ -241,7 +241,7 @@ with their default settings
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
BEMOJI_DB_LOCATION=$XDG_DATA_HOME/bemoji # where the emoji lists reside
|
BEMOJI_DB_LOCATION=$XDG_DATA_HOME/bemoji # where the emoji lists reside
|
||||||
BEMOJI_CACHE_LOCATION=$XDG_STATE_HOME # where the state file resides
|
BEMOJI_HISTORY_LOCATION=$XDG_STATE_HOME # where the state file resides
|
||||||
BEMOJI_CUSTOM_LIST="" # the custom emoji list to display
|
BEMOJI_CUSTOM_LIST="" # the custom emoji list to display
|
||||||
BEMOJI_DOWNLOAD_LIST="" # the default emoji lists to download to database
|
BEMOJI_DOWNLOAD_LIST="" # the default emoji lists to download to database
|
||||||
BEMOJI_DEFAULT_COMMAND=<clip-tool> # which command to invoke by default
|
BEMOJI_DEFAULT_COMMAND=<clip-tool> # which command to invoke by default
|
||||||
|
|
6
bemoji
6
bemoji
|
@ -5,9 +5,9 @@ bm_version=0.2.0
|
||||||
bm_db_location=${BEMOJI_DB_LOCATION:-"${XDG_DATA_HOME:-$HOME/.local/share}/bemoji"}
|
bm_db_location=${BEMOJI_DB_LOCATION:-"${XDG_DATA_HOME:-$HOME/.local/share}/bemoji"}
|
||||||
# Setting custom emoji list file location:
|
# Setting custom emoji list file location:
|
||||||
# BEMOJI_CUSTOM_LIST=/my/location/emojis.txt
|
# BEMOJI_CUSTOM_LIST=/my/location/emojis.txt
|
||||||
# Setting custom recent emoji cache:
|
# Setting custom recent emoji history:
|
||||||
# BEMOJI_CACHE_LOCATION=/path/to/my/recents/directory
|
# BEMOJI_HISTORY_LOCATION=/path/to/my/recents/directory
|
||||||
bm_state_dir="${BEMOJI_CACHE_LOCATION:-${XDG_STATE_HOME:-$HOME/.local/state}}"
|
bm_state_dir="${BEMOJI_HISTORY_LOCATION:-${XDG_STATE_HOME:-$HOME/.local/state}}"
|
||||||
bm_history_file="${bm_state_dir}/bemoji-history.txt"
|
bm_history_file="${bm_state_dir}/bemoji-history.txt"
|
||||||
|
|
||||||
# Command to run after user chooses an emoji
|
# Command to run after user chooses an emoji
|
||||||
|
|
|
@ -15,8 +15,8 @@ setup() {
|
||||||
|
|
||||||
# set up small default set of test emoji for each test
|
# set up small default set of test emoji for each test
|
||||||
export BEMOJI_DB_LOCATION="$BATS_TEST_TMPDIR/database"
|
export BEMOJI_DB_LOCATION="$BATS_TEST_TMPDIR/database"
|
||||||
export BEMOJI_CACHE_LOCATION="$BATS_TEST_TMPDIR/cache"
|
export BEMOJI_HISTORY_LOCATION="$BATS_TEST_TMPDIR/history"
|
||||||
mkdir -p "$BEMOJI_DB_LOCATION" "$BEMOJI_CACHE_LOCATION"
|
mkdir -p "$BEMOJI_DB_LOCATION" "$BEMOJI_HISTORY_LOCATION"
|
||||||
cat "$BATS_TEST_DIRNAME/resources/test_emoji.txt" > "$BEMOJI_DB_LOCATION/emoji.txt"
|
cat "$BATS_TEST_DIRNAME/resources/test_emoji.txt" > "$BEMOJI_DB_LOCATION/emoji.txt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ setup() {
|
||||||
|
|
||||||
# set up small default set of test emoji for each test
|
# set up small default set of test emoji for each test
|
||||||
export BEMOJI_DB_LOCATION="$BATS_TEST_TMPDIR/database"
|
export BEMOJI_DB_LOCATION="$BATS_TEST_TMPDIR/database"
|
||||||
export BEMOJI_CACHE_LOCATION="$BATS_TEST_TMPDIR/cache"
|
export BEMOJI_HISTORY_LOCATION="$BATS_TEST_TMPDIR/history"
|
||||||
mkdir -p "$BEMOJI_DB_LOCATION" "$BEMOJI_CACHE_LOCATION"
|
mkdir -p "$BEMOJI_DB_LOCATION" "$BEMOJI_HISTORY_LOCATION"
|
||||||
cat "$BATS_TEST_DIRNAME/resources/test_emoji.txt" > "$BEMOJI_DB_LOCATION/emoji.txt"
|
cat "$BATS_TEST_DIRNAME/resources/test_emoji.txt" > "$BEMOJI_DB_LOCATION/emoji.txt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ database=$BATS_TEST_TMPDIR/xdb-db/bemoji
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "sets XDG directory for history by default" {
|
@test "sets XDG directory for history by default" {
|
||||||
unset BEMOJI_CACHE_LOCATION
|
unset BEMOJI_HISTORY_LOCATION
|
||||||
export XDG_STATE_HOME="$BATS_TEST_TMPDIR/xdb-cache"
|
export XDG_STATE_HOME="$BATS_TEST_TMPDIR/xdb-cache"
|
||||||
run bemoji -v
|
run bemoji -v
|
||||||
assert_output --regexp "
|
assert_output --regexp "
|
||||||
|
@ -54,7 +54,7 @@ database=$HOME/.local/share/bemoji
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "falls back to default history location if no XDG found" {
|
@test "falls back to default history location if no XDG found" {
|
||||||
unset BEMOJI_CACHE_LOCATION
|
unset BEMOJI_HISTORY_LOCATION
|
||||||
run bemoji -v
|
run bemoji -v
|
||||||
assert_output --regexp "
|
assert_output --regexp "
|
||||||
history=$HOME/.local/state/bemoji-history.txt$"
|
history=$HOME/.local/state/bemoji-history.txt$"
|
||||||
|
@ -67,8 +67,8 @@ database=$BATS_TEST_TMPDIR/database
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
@test "BEMOJI_CACHE_LOCATION sets correct cache directory" {
|
@test "BEMOJI_HISTORY_LOCATION sets correct history directory" {
|
||||||
run bemoji -v
|
run bemoji -v
|
||||||
assert_output --regexp "
|
assert_output --regexp "
|
||||||
history=$BATS_TEST_TMPDIR/cache/bemoji-history.txt$"
|
history=$BATS_TEST_TMPDIR/history/bemoji-history.txt$"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue