From 71d5dc455de7f7e0adb206d0fea2988daf39486e Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 11 Apr 2023 22:05:16 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A6=8A=20Exit=20status=201=20on=20cancell?= =?UTF-8?q?ed=20selection=20(#20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When making no selection, i.e. cancelling during the selection process the program will return status code 1, whereas before it would carry the same return code as when making an emoji selection. Fixes #20. --- CHANGELOG.md | 4 +++- bemoji | 2 +- test/bemoji_cmds.bats | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 022b526..e8b0972 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - +### Added + +- Pass through return code 1 from selection tool ### Changed diff --git a/bemoji b/bemoji index 6da4e86..1a7c35a 100755 --- a/bemoji +++ b/bemoji @@ -206,7 +206,7 @@ result=$(echo "$result" | grep -o '^\S\+' | tr -d '\n') case "$exit_value" in 1) - exit + exit 1 ;; 0) if [ ${#bm_cmds[@]} -eq 0 ]; then diff --git a/test/bemoji_cmds.bats b/test/bemoji_cmds.bats index 2d0f324..2b0a176 100644 --- a/test/bemoji_cmds.bats +++ b/test/bemoji_cmds.bats @@ -64,6 +64,11 @@ typing result" assert_output "my clipping" } +@test "Returns status code 1 on picker status code 1" { + BEMOJI_PICKER_CMD="return 1" run bemoji -e 3>&- + assert_failure 1 +} + @test "Prints output with newline by default" { bats_require_minimum_version 1.5.0 BEMOJI_PICKER_CMD="echo heart" run --keep-empty-lines -- bemoji -e