Make port arguments last and optional

These changes allow library users to leave out port arguments to instead use
current-output-port.

* termenv/hyperlink.scm (format-hyperlink): Move port to the end of the argument
list and make it default to #t.
(format-hyperlink, hyperlink): Make name optional and use link if it is not
provided.
This commit is contained in:
Juliana Rat 2024-02-11 15:37:12 -05:00
parent 09083afe11
commit 24d2341cf9
1 changed files with 3 additions and 3 deletions

View File

@ -3,11 +3,11 @@
#:export (format-hyperlink
hyperlink))
(define (format-hyperlink port link name)
(define* (format-hyperlink link #:optional name (port #t))
"Output a hyperlink using OSC8 to the provided port"
(format port (hyperlink link name)))
(define (hyperlink link name)
(define* (hyperlink link #:optional name)
"Create an OSC8 hyperlink sequence"
(string-append %OSC "8;;" link %ST name %OSC "8;;" %ST))
(string-append %OSC "8;;" link %ST (or name link) %OSC "8;;" %ST))