From d746b39983b43dbb117da8ba41dd206d720d0b9b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 9 Aug 2022 15:01:09 -0700 Subject: Support compiling and path search. - In the hash bang line: - use /usr/bin/env to find txr in the PATH. - Use new txrlisp hard link, which the file compiler will translate to txrvm for compiled code - Main code is wrapped in (compile-only ...) so that it isn't executed during compilation. --- ger2err | 75 +++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/ger2err b/ger2err index fd68719..d1b9efc 100755 --- a/ger2err +++ b/ger2err @@ -1,4 +1,4 @@ -#!/usr/local/bin/txr --lisp +#!/usr/bin/env txrlisp ;; vim:filetype=tl:lisp: (defvarl %prog% *load-path*) @@ -106,42 +106,43 @@ May be given via GER2ERR_PASSWORD\ \ environment variable.")) -(catch - (let ((o (new opts)) - (ps-sel :all)) - o.(getopts *args*) - (when o.help - (put-line `\nUsage:\n\n @{%prog%} [options] change-id`) - o.(opthelp) - (exit nil)) +(compile-only + (catch + (let ((o (new opts)) + (ps-sel :all)) + o.(getopts *args*) + (when o.help + (put-line `\nUsage:\n\n @{%prog%} [options] change-id`) + o.(opthelp) + (exit nil)) - (match-case o.patchset - (nil) - ("all" (set ps-sel :all)) - ("highest" (set ps-sel :highest)) - (`@{num #/[1-9][0-9]*/}` (set ps-sel (int-str num))) - (@else (fatal "bad argument to --patchset"))) + (match-case o.patchset + (nil) + ("all" (set ps-sel :all)) + ("highest" (set ps-sel :highest)) + (`@{num #/[1-9][0-9]*/}` (set ps-sel (int-str num))) + (@else (fatal "bad argument to --patchset"))) - (gerrit-config (or o.userid - (getenv "GER2ERR_USERID") - (fatal "userid required")) - (or o.password - (getenv "GER2ERR_PASSWORD") - (fatal "password required")) - (or o.server - (getenv "GER2ERR_SERVER") - (fatal "server URL required"))) + (gerrit-config (or o.userid + (getenv "GER2ERR_USERID") + (fatal "userid required")) + (or o.password + (getenv "GER2ERR_PASSWORD") + (fatal "password required")) + (or o.server + (getenv "GER2ERR_SERVER") + (fatal "server URL required"))) - (match-case o.out-args - ((@change-id) (let ((ps-hash (get-gerrit-comments change-id o.resolved))) - (match-case ps-sel - (@(or (integerp @psnum) - @(and :highest - @(with psnum [find-max-key ps-hash : car]))) - (print-as-errors [ps-hash psnum])) - (@else - (each ((psnum (sort (hash-keys ps-hash)))) - (print-as-errors [ps-hash psnum])))))) - (@else (fatal "change-id argument required: use --help for usage.")))) - (opt-error (msg) - (fatal msg))) + (match-case o.out-args + ((@change-id) (let ((ps-hash (get-gerrit-comments change-id o.resolved))) + (match-case ps-sel + (@(or (integerp @psnum) + @(and :highest + @(with psnum [find-max-key ps-hash : car]))) + (print-as-errors [ps-hash psnum])) + (@else + (each ((psnum (sort (hash-keys ps-hash)))) + (print-as-errors [ps-hash psnum])))))) + (@else (fatal "change-id argument required: use --help for usage.")))) + (opt-error (msg) + (fatal msg)))) -- cgit v1.2.3