From f791bf093c6597d40993fbd32e9cae932fab0a43 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 29 Jun 2022 08:20:22 +0200 Subject: [PATCH 01/11] =?UTF-8?q?=F0=9F=93=96=20Document=20version=20and?= =?UTF-8?q?=20help=20options=20in=20cli=20help?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bemoji | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bemoji b/bemoji index babfdc8..92661f1 100755 --- a/bemoji +++ b/bemoji @@ -33,6 +33,8 @@ usage() { echo " -e Only echo out the picked emoji." echo " -D Choose specific default lists to download if none found locally." echo " Valid choices: all|none|emoji|math." + echo " -v Display current program version." + echo " -h Show this help." echo exit "$1" } From edd5ebd74325e9a73fc3ba8487e6fe2328acbbd4 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 29 Jun 2022 08:34:05 +0200 Subject: [PATCH 02/11] =?UTF-8?q?=F0=9F=93=96=20Improve=20installation=20d?= =?UTF-8?q?ocumentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switched sections for dependencies and installation around and created better sub-headings. Added section on installing packaged AUR version, thanks to @firegem for packaging it! Fixed some whitespace on line endings. Closes #6. --- README.md | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 09fd59d..99042a4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# bemoji ❤ - Quickly ⛏ your 🌟 +# bemoji ❤️ - Quickly ⛏️ your 🌟 ![bemoji picker interface on bemenu](assets/bemenu.png) @@ -8,8 +8,20 @@ Will remember your favorite emojis and give you quick access. ## 📁 Installation +### Dependencies + +* One of `bemenu`, `wofi`, `rofi`, `dmenu`, or supplying your own picker. +* One of `wl-copy`, `xclip`, `xsel` or supplying your own clipboard tool. +* One of `wtype`, `xdotool` or supplying your own typing tool. +* `sed`, `grep`, `cut`, `sort`, `uniq`, `tr`, `curl` if using the download functionality. + +To see how to substitute the default choices with your own tools, +see Options below. + ![rofi picker interface](assets/rofi.png) +### Manual + Option 1. Clone the repository and put the executable somewhere in your path: ```bash @@ -27,16 +39,13 @@ chmod +x bemoji/bemoji ln -s bemoji/bemoji /usr/local/bin/bemoji ``` -Dependencies: +### Arch Linux -* One of `bemenu`, `wofi`, `rofi`, `dmenu`, or supplying your own picker. -* One of `wl-copy`, `xclip`, `xsel` or supplying your own clipboard tool. -* One of `wtype`, `xdotool` or supplying your own typing tool. -* `sed`, `grep`, `cut`, `sort`, `uniq`, `tr`, `curl` if using the download functionality. - -To see how to substitute the default choices with your own tools, -see Options below. +On Arch Linux, bemoji has been packaged for the [AUR](https://aur.archlinux.org/packages/bemoji-git) so it can be installed manually from here or easily with your preferred AUR helper, e.g.: +```bash +paru -S bemoji-git +``` ## 💿 Usage @@ -50,7 +59,7 @@ When the emoji list is open you can always press `Alt+1` to send the selected em regardless of what the default action is set to. (Currently works in bemenu and rofi.) -You can also map the picker to a key combination for quick access, e.g. +You can also map the picker to a key combination for quick access, e.g. In `swaywm`, put the following in `~/.config/sway/config`: @@ -88,7 +97,7 @@ bemoji comes with a couple of options to specify actions, emoji libraries and di ### Adding your own emoji Simply put your own emoji list into the bemoji data directory. -By default, the directory will be at your `$XDG_DATA_HOME/bemoji` location - +By default, the directory will be at your `$XDG_DATA_HOME/bemoji` location - most likely this is `~/.local/share/bemoji`. Add any number of `.txt` files containing additional emoji to this directory: @@ -118,7 +127,7 @@ You can also stop bemoji from adding any emoji to your history in the first plac bemoji -p ``` -This will not add any of the emoji you pick to your recent emojis. +This will not add any of the emoji you pick to your recent emojis. Put both together to completely ignore the recent emoji feature of the program: ```bash @@ -128,12 +137,12 @@ bemoji -Pp Like this, you'll be hiding any recent personal emoji and no one will know that you always type 👄🍆💦. The recent list will also contain emoji that are *not* usually on your lists, -so kept in single-use lists for example. +so kept in single-use lists for example. If you don't wish those to show up, make use of these options. ### Setting custom directories -By default bemoji stores your recent history in `$XDG_CACHE_HOME/bemoji-history.txt`, +By default bemoji stores your recent history in `$XDG_CACHE_HOME/bemoji-history.txt`, so most often in `~/.cache/bemoji-history.txt` You can overwrite the directories bemoji uses for its emoji lists and history files with the following two environment variables: @@ -153,8 +162,8 @@ A custom emoji list can be supplied as commandline argument `-f` or `BEMOJI_CUST bemoji -f path/to/my/list.txt ``` -The list will override the normally presented emoji, -so that only the custom list and recent emoji will be displayed. +The list will override the normally presented emoji, +so that only the custom list and recent emoji will be displayed. To display *only* the emoji list passed in, pass an extra `-P` flag to bemoji. The path can also be a weblink which bemoji will download and use: @@ -173,10 +182,10 @@ To change this setting, execute bemoji like the following: bemoji -D all ``` -This will download *all* default sets bemoji knows - which is currently the default emoji list and a long list of math symbols. +This will download *all* default sets bemoji knows - which is currently the default emoji list and a long list of math symbols. Other valid options for this setting are `emoji`, `math`, `none`. -If set to `none` and no files are in the emoji directory, +If set to `none` and no files are in the emoji directory, bemoji will simply complain and not show anything. ### Using a custom tool for picking, clipping, typing @@ -204,12 +213,12 @@ bemoji -e | cat <(echo -n "https://emojipedia.org/") - | xargs xdg-open This snippet will open a wiki page for the picked emoji in your browser. -Of course, there are many more possibilities. +Of course, there are many more possibilities. This is just an example to show how the echo mode works. ### A list of all environment variables -What follows is a list of all environment variables bemoji understands, +What follows is a list of all environment variables bemoji understands, with their default settings ```bash From ceea79eb3a8a1a15825ce7646bc3b4f8c4b2223f Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 29 Jun 2022 09:25:28 +0200 Subject: [PATCH 03/11] =?UTF-8?q?=F0=9F=A7=AA=20Add=20simple=20test=20fram?= =?UTF-8?q?ework?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that the project is finding a little adoption it is really high time to bring some tests into the code to ensure everything works as it should. This first version will only provide a simple test harness from which tests can slowly be written for other parts of the program. --- .gitmodules | 9 +++++++++ test/bats | 1 + test/bemoji.bats | 17 +++++++++++++++++ test/test_helper/bats-assert | 1 + test/test_helper/bats-support | 1 + 5 files changed, 29 insertions(+) create mode 100644 .gitmodules create mode 160000 test/bats create mode 100644 test/bemoji.bats create mode 160000 test/test_helper/bats-assert create mode 160000 test/test_helper/bats-support diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..b7efcb4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,9 @@ +[submodule "test/bats"] + path = test/bats + url = https://github.com/bats-core/bats-core.git +[submodule "test/test_helper/bats-support"] + path = test/test_helper/bats-support + url = https://github.com/bats-core/bats-support.git +[submodule "test/test_helper/bats-assert"] + path = test/test_helper/bats-assert + url = https://github.com/bats-core/bats-assert.git diff --git a/test/bats b/test/bats new file mode 160000 index 0000000..26c9b18 --- /dev/null +++ b/test/bats @@ -0,0 +1 @@ +Subproject commit 26c9b18983c3ce4cf24c6f6ee942abd8b1c3ee18 diff --git a/test/bemoji.bats b/test/bemoji.bats new file mode 100644 index 0000000..ad9936d --- /dev/null +++ b/test/bemoji.bats @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +setup() { + load 'test_helper/bats-support/load' + load 'test_helper/bats-assert/load' + + # make bemoji executable from anywhere relative to current testfile + TEST_DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" + PATH="$TEST_DIR/..:$PATH" +} + +@test "test can run script" { + # closing FD3 manually to prevent hangs, see + # https://bats-core.readthedocs.io/en/stable/writing-tests.html#file-descriptor-3-read-this-if-bats-hangs + run bemoji 3>&- + assert_success +} diff --git a/test/test_helper/bats-assert b/test/test_helper/bats-assert new file mode 160000 index 0000000..ffe84ea --- /dev/null +++ b/test/test_helper/bats-assert @@ -0,0 +1 @@ +Subproject commit ffe84ea5dd43b568851549b3e241db150c12929c diff --git a/test/test_helper/bats-support b/test/test_helper/bats-support new file mode 160000 index 0000000..3c8fadc --- /dev/null +++ b/test/test_helper/bats-support @@ -0,0 +1 @@ +Subproject commit 3c8fadc5097c9acfc96d836dced2bb598e48b009 From 936f19bca6ceda9da55286672faba4c329a6b45f Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 29 Jun 2022 10:55:47 +0200 Subject: [PATCH 04/11] =?UTF-8?q?=F0=9F=A7=AA=20Set=20up=20default=20emoji?= =?UTF-8?q?=20list=20for=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Inject a tiny sample emoji list into each test so no download function is engaged by default. Add tests for version display. --- bemoji | 2 +- test/bemoji.bats | 20 ++++++++++++++++++++ test/resources/test_emoji.txt | 4 ++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 test/resources/test_emoji.txt diff --git a/bemoji b/bemoji index 92661f1..aadd9a8 100755 --- a/bemoji +++ b/bemoji @@ -40,7 +40,7 @@ usage() { } version() { - echo "v${bm_version}" + printf "v%s" "$bm_version" exit } diff --git a/test/bemoji.bats b/test/bemoji.bats index ad9936d..6229b50 100644 --- a/test/bemoji.bats +++ b/test/bemoji.bats @@ -7,6 +7,14 @@ setup() { # make bemoji executable from anywhere relative to current testfile TEST_DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" PATH="$TEST_DIR/..:$PATH" + + # mock out interactive picker for static emoji return + export BEMOJI_PICKER_CMD="echo ❤️" + # set up small default set of test emoji for each test + export BEMOJI_DB_LOCATION="$BATS_TEST_TMPDIR/database" + export BEMOJI_CACHE_LOCATION="$BATS_TEST_TMPDIR/cache" + mkdir -p "$BEMOJI_DB_LOCATION" "$BEMOJI_CACHE_LOCATION" + cat "$BATS_TEST_DIRNAME/resources/test_emoji.txt" > "$BEMOJI_DB_LOCATION/emoji.txt" } @test "test can run script" { @@ -15,3 +23,15 @@ setup() { run bemoji 3>&- assert_success } + +@test "test receives custom picker mock output" { + run bemoji -e 3>&- + assert_output "❤️" +} + +@test "-v prints correct version number" { + the_version=$(grep 'bm_version=' $(which bemoji)) + + run bemoji -v + assert_output "v${the_version#bm_version=}" +} diff --git a/test/resources/test_emoji.txt b/test/resources/test_emoji.txt new file mode 100644 index 0000000..cdb4060 --- /dev/null +++ b/test/resources/test_emoji.txt @@ -0,0 +1,4 @@ +❤️ red heart +😀 grinning face +😃 grinning face with big eyes +😄 grinning face with smiling eyes From b9708405fa34d022cc338aab4cd84126f23a107a Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 29 Jun 2022 12:44:03 +0200 Subject: [PATCH 05/11] =?UTF-8?q?=F0=9F=93=96=20Add=20testing=20instructio?= =?UTF-8?q?ns=20to=20readme?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 99042a4..f84b3e3 100644 --- a/README.md +++ b/README.md @@ -241,3 +241,12 @@ Thanks for checking this program out! ❤ If there are any problems, don't hesitate to open an issue. If you have an idea or improvement, don't hesitate to open a merge request! + +### Running tests + +This project makes use of [bash-bats](https://github.com/bats-core/bats-core) (community fork) to test some of its functionality. + +To run the tests locally, simply execute `./test/bats/bin/bats test`. + +I would suggest running the test suite in docker instead, just to minimize the possibility of something going awry and borking up your local file system. +To run the tests in a docker suite, execute `docker run --rm -it -v "$PWD:/code" bats/bats:latest /code/test` From 75395d2bbd55834f51f0262652665065890753e1 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 29 Jun 2022 09:53:04 +0200 Subject: [PATCH 06/11] =?UTF-8?q?=F0=9F=90=9B=20Fix=20custom=20command=20i?= =?UTF-8?q?nvocation=20quoting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bemoji | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bemoji b/bemoji index aadd9a8..576c644 100755 --- a/bemoji +++ b/bemoji @@ -137,7 +137,8 @@ add_to_recent() { # Set default clipboard util _clipper() { if [ -n "$BEMOJI_CLIP_CMD" ]; then - "${BEMOJI_CLIP_CMD[@]}" + # shellcheck disable=SC2068 + ${BEMOJI_CLIP_CMD[@]} elif [ -n "$WAYLAND_DISPLAY" ] && command -v wl-copy >/dev/null 2>&1; then wl-copy elif [ -n "$DISPLAY" ] && command -v xclip >/dev/null 2>&1; then @@ -154,7 +155,8 @@ _clipper() { _typer() { totype=$(cat -) if [ -n "$BEMOJI_TYPE_CMD" ]; then - "${BEMOJI_TYPE_CMD[@]}" + # shellcheck disable=SC2068 + ${BEMOJI_TYPE_CMD[@]} elif [ -n "$WAYLAND_DISPLAY" ] && command -v wtype >/dev/null 2>&1; then wtype -s 30 "$totype" elif [ -n "$DISPLAY" ] && command -v xdotool >/dev/null 2>&1; then @@ -168,7 +170,8 @@ _typer() { # Set default picker util _picker() { if [ -n "$BEMOJI_PICKER_CMD" ]; then - "${BEMOJI_PICKER_CMD[@]}" + # shellcheck disable=SC2068 + ${BEMOJI_PICKER_CMD[@]} elif command -v bemenu >/dev/null 2>&1; then bemenu -p 🔍 -i -l 20 elif command -v wofi >/dev/null 2>&1; then From 0b255413d0557b6a90cf6448d13dcc95c5cb31a1 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 29 Jun 2022 10:08:01 +0200 Subject: [PATCH 07/11] =?UTF-8?q?=F0=9F=A6=8A=20Simplify=20grep=20string?= =?UTF-8?q?=20for=20POSIX=20compatibility?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bemoji | 2 +- test/bemoji.bats | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bemoji b/bemoji index 576c644..4619e30 100755 --- a/bemoji +++ b/bemoji @@ -199,7 +199,7 @@ _clipResult() { result=$(gather_emojis | _picker) exit_value="$?" [ "$bm_private_mode" = true ] || add_to_recent "$result" -result=$(echo "$result" | grep -oP '^[^\s]+' | tr -d '\n') +result=$(echo "$result" | grep -o '^\S\+' | tr -d '\n') case "$exit_value" in 1) diff --git a/test/bemoji.bats b/test/bemoji.bats index 6229b50..a7621a3 100644 --- a/test/bemoji.bats +++ b/test/bemoji.bats @@ -18,6 +18,7 @@ setup() { } @test "test can run script" { + export BEMOJI_CLIP_CMD="echo clip test only" # closing FD3 manually to prevent hangs, see # https://bats-core.readthedocs.io/en/stable/writing-tests.html#file-descriptor-3-read-this-if-bats-hangs run bemoji 3>&- From 31550448f00e8f4d024508533962485567de1068 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 29 Jun 2022 11:44:15 +0200 Subject: [PATCH 08/11] =?UTF-8?q?=F0=9F=A6=8A=20Add=20display=20for=20dire?= =?UTF-8?q?ctory=20config=20to=20-v=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added a quick way to see if directories have been set up correctly. This also eases testing for future ways of setting directories through environment variables or options. --- bemoji | 4 ++-- test/bemoji.bats | 33 ++++++++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/bemoji b/bemoji index 4619e30..e468965 100755 --- a/bemoji +++ b/bemoji @@ -33,14 +33,14 @@ usage() { echo " -e Only echo out the picked emoji." echo " -D Choose specific default lists to download if none found locally." echo " Valid choices: all|none|emoji|math." - echo " -v Display current program version." + echo " -v Display current program version and directory configuration." echo " -h Show this help." echo exit "$1" } version() { - printf "v%s" "$bm_version" + printf "v%s\ndatabase=%s\nhistory=%s\n" "$bm_version" "$bm_db_location" "$bm_history_file" exit } diff --git a/test/bemoji.bats b/test/bemoji.bats index a7621a3..0a87288 100644 --- a/test/bemoji.bats +++ b/test/bemoji.bats @@ -10,6 +10,7 @@ setup() { # mock out interactive picker for static emoji return export BEMOJI_PICKER_CMD="echo ❤️" + # set up small default set of test emoji for each test export BEMOJI_DB_LOCATION="$BATS_TEST_TMPDIR/database" export BEMOJI_CACHE_LOCATION="$BATS_TEST_TMPDIR/cache" @@ -34,5 +35,35 @@ setup() { the_version=$(grep 'bm_version=' $(which bemoji)) run bemoji -v - assert_output "v${the_version#bm_version=}" + assert_output --partial "v${the_version#bm_version=}" +} + +@test "sets XDG directory for db by default" { + unset BEMOJI_DB_LOCATION + export XDG_DATA_HOME="$BATS_TEST_TMPDIR/xdb-db" + run bemoji -v + assert_output --regexp " +database=$BATS_TEST_TMPDIR/xdb-db/bemoji +" +} + +@test "sets XDG directory for cache by default" { + unset BEMOJI_CACHE_LOCATION + export XDG_CACHE_HOME="$BATS_TEST_TMPDIR/xdb-cache" + run bemoji -v + assert_output --regexp " +history=$BATS_TEST_TMPDIR/xdb-cache/bemoji-history.txt$" +} + +@test "BEMOJI_DB_LOCATION sets correct db directory" { + run bemoji -v + assert_output --regexp " +database=$BATS_TEST_TMPDIR/database +" +} + +@test "BEMOJI_CACHE_LOCATION sets correct cache directory" { + run bemoji -v + assert_output --regexp " +history=$BATS_TEST_TMPDIR/cache/bemoji-history.txt$" } From ce17ae58f12e0b307b6a246faa23af20595babd7 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 29 Jun 2022 11:51:41 +0200 Subject: [PATCH 09/11] =?UTF-8?q?=F0=9F=93=96=20Add=20simple=20Changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a7ff5e9 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,28 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added + +- Display of configuration options on `-v` toggle + +### Changed + +- Simplified grep invocation to adhere more closely to POSIX + + + + + +### Fixed + +- Custom picker, clipper, and typer command invocation (`BEMOJI_CLIP_CMD`) + + + + From 2a17237a962513870f616db2df45737baf5d40aa Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 29 Jun 2022 11:58:51 +0200 Subject: [PATCH 10/11] =?UTF-8?q?=F0=9F=A7=AA=20Add=20tests=20for=20XDG=20?= =?UTF-8?q?base=20directory=20adherence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added simple tests for database and cache locations. Moved test PATH setup to new file-level function which should slightly speed up testing and makes more sense conceptually to set the bemoji executable to be in the path once for all tests. --- test/bemoji.bats | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/test/bemoji.bats b/test/bemoji.bats index 0a87288..cff3af6 100644 --- a/test/bemoji.bats +++ b/test/bemoji.bats @@ -1,13 +1,15 @@ #!/usr/bin/env bash +setup_file() { + # make bemoji executable from anywhere relative to current testfile + TEST_DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" + PATH="$TEST_DIR/..:$PATH" +} + setup() { load 'test_helper/bats-support/load' load 'test_helper/bats-assert/load' - # make bemoji executable from anywhere relative to current testfile - TEST_DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" - PATH="$TEST_DIR/..:$PATH" - # mock out interactive picker for static emoji return export BEMOJI_PICKER_CMD="echo ❤️" @@ -18,7 +20,7 @@ setup() { cat "$BATS_TEST_DIRNAME/resources/test_emoji.txt" > "$BEMOJI_DB_LOCATION/emoji.txt" } -@test "test can run script" { +@test "can run script" { export BEMOJI_CLIP_CMD="echo clip test only" # closing FD3 manually to prevent hangs, see # https://bats-core.readthedocs.io/en/stable/writing-tests.html#file-descriptor-3-read-this-if-bats-hangs @@ -26,7 +28,7 @@ setup() { assert_success } -@test "test receives custom picker mock output" { +@test "can receive custom picker mock output" { run bemoji -e 3>&- assert_output "❤️" } @@ -47,7 +49,7 @@ database=$BATS_TEST_TMPDIR/xdb-db/bemoji " } -@test "sets XDG directory for cache by default" { +@test "sets XDG directory for history by default" { unset BEMOJI_CACHE_LOCATION export XDG_CACHE_HOME="$BATS_TEST_TMPDIR/xdb-cache" run bemoji -v @@ -55,6 +57,21 @@ database=$BATS_TEST_TMPDIR/xdb-db/bemoji history=$BATS_TEST_TMPDIR/xdb-cache/bemoji-history.txt$" } +@test "falls back to default db directory if no XDG found" { + unset BEMOJI_DB_LOCATION + run bemoji -v + assert_output --regexp " +database=$HOME/.local/share/bemoji +" +} + +@test "falls back to default history location if no XDG found" { + unset BEMOJI_CACHE_LOCATION + run bemoji -v + assert_output --regexp " +history=$HOME/.cache/bemoji-history.txt$" +} + @test "BEMOJI_DB_LOCATION sets correct db directory" { run bemoji -v assert_output --regexp " From 7cec73e2dbdc7702d67116cc729f48f9248ceba0 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 29 Jun 2022 12:32:13 +0200 Subject: [PATCH 11/11] =?UTF-8?q?=F0=9F=93=96=20Bump=20version,=20add=20to?= =?UTF-8?q?=20changelog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 27 +++++++++++++++++---------- LICENSE | 2 +- bemoji | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7ff5e9..6103f22 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,22 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -### Added + -- Display of configuration options on `-v` toggle - -### Changed - -- Simplified grep invocation to adhere more closely to POSIX + -### Fixed - -- Custom picker, clipper, and typer command invocation (`BEMOJI_CLIP_CMD`) + - +## [0.2.0] - 2022-06-29 + +### Added + +- Display of configuration options on `-v` toggle +- AUR installation instructions + +### Changed + +- Simplified grep invocation to adhere more closely to POSIX + +### Fixed + +- Custom picker, clipper, and typer command invocation quoting diff --git a/LICENSE b/LICENSE index 3849f8a..aa51234 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Marty Oehme +Copyright (c) 2022 Marty Oehme Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/bemoji b/bemoji index e468965..da39218 100755 --- a/bemoji +++ b/bemoji @@ -1,6 +1,6 @@ #!/usr/bin/env bash -bm_version=0.1 +bm_version=0.2.0 # Emoji default database location bm_db_location=${BEMOJI_DB_LOCATION:-"${XDG_DATA_HOME:-$HOME/.local/share}/bemoji"} # Setting custom emoji list file location: