summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-03-14 14:21:17 +0530
committerArun Isaac2022-03-14 14:21:17 +0530
commit17d101b2f97edc8574528d5f05dd952921b67027 (patch)
tree42f5cd9c8c933cdf3c77f42e17e542223edbb13f
parent015eab3dd8a55c29e463608b29a00e4e449036ec (diff)
downloadtissue-17d101b2f97edc8574528d5f05dd952921b67027.tar.gz
tissue-17d101b2f97edc8574528d5f05dd952921b67027.tar.lz
tissue-17d101b2f97edc8574528d5f05dd952921b67027.zip
bin: Handle message conditions.
* bin/tissue: Import (rnrs exceptions). (main): Handle message conditions by printing them and exiting with failure.
-rwxr-xr-xbin/tissue27
1 files changed, 16 insertions, 11 deletions
diff --git a/bin/tissue b/bin/tissue
index ff593c6..2e06ac4 100755
--- a/bin/tissue
+++ b/bin/tissue
@@ -20,6 +20,7 @@
;;; along with tissue. If not, see <https://www.gnu.org/licenses/>.
(import (rnrs conditions)
+ (rnrs exceptions)
(rnrs io ports)
(srfi srfi-1)
(srfi srfi-26)
@@ -368,17 +369,21 @@ To get usage information for one of these sub-commands, run
((_ (or "-h" "--help"))
(print-usage))
((_ command args ...)
- (apply (match command
- ("news" tissue-news)
- ("list" tissue-list)
- ("edit" tissue-edit)
- ("show" tissue-show)
- (invalid-command
- (format (current-error-port) "Invalid command `~a'~%~%"
- invalid-command)
- (print-usage)
- (exit #f)))
- args))
+ (guard (c ((message-condition? c)
+ (display (condition-message c) (current-error-port))
+ (newline (current-error-port))
+ (exit #f)))
+ (apply (match command
+ ("news" tissue-news)
+ ("list" tissue-list)
+ ("edit" tissue-edit)
+ ("show" tissue-show)
+ (invalid-command
+ (format (current-error-port) "Invalid command `~a'~%~%"
+ invalid-command)
+ (print-usage)
+ (exit #f)))
+ args)))
;; tissue is an alias for `tissue list'
((_)
(tissue-list))))