From a8868a3f7b6940a3699fccc5cd6f956c72475ac9 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 22 Sep 2021 16:02:18 +0530 Subject: gnbug: Add show sub-command. * gnbug: Import (rnrs io ports). (main): Add show sub-command. (gnbug-show): New function. * README.gmi (gnbug): Document the show sub-command. --- README.gmi | 5 +++++ gnbug | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.gmi b/README.gmi index b08ae8b..b400a8d 100644 --- a/README.gmi +++ b/README.gmi @@ -38,6 +38,11 @@ Only list issues assigned to pjotrp. ./gnbug list --assigned=pjotrp ``` +Print an issue, say issue 7, on the command line. +``` +./gnbug show 7 +``` + Edit an issue, say issue 9. This opens the relevant gemtext file in your favourite editor as defined by the EDITOR environment variable. ``` ./gnbug edit 9 diff --git a/gnbug b/gnbug index 02966ba..2b42111 100755 --- a/gnbug +++ b/gnbug @@ -2,6 +2,7 @@ !# (import (rnrs hashtables) + (rnrs io ports) (srfi srfi-9) (srfi srfi-26) (srfi srfi-37) @@ -238,13 +239,20 @@ export EDITOR=emacsclient")) (issue-file (list-ref (issues) (1- (string->number issue-number)))))) +(define (gnbug-show issue-number) + (put-string (current-output-port) + (call-with-input-file (issue-file (list-ref (issues) + (1- (string->number issue-number)))) + get-string-all))) + (define main (match-lambda* ((_ command args ...) (apply (match command ("news" gnbug-news) ("list" gnbug-list) - ("edit" gnbug-edit)) + ("edit" gnbug-edit) + ("show" gnbug-show)) args)) ;; gnbug is an alias for `gnbug list' ((_) -- cgit v1.2.3