aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-08-09 15:01:09 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-08-09 15:01:09 -0700
commitd746b39983b43dbb117da8ba41dd206d720d0b9b (patch)
tree1cfbd86e04e8f941d746ff77c3e30717a4afdec1
parenta0ea69134bb555e537b019633217b19acdaf1930 (diff)
downloadger2err-d746b39983b43dbb117da8ba41dd206d720d0b9b.tar.gz
ger2err-d746b39983b43dbb117da8ba41dd206d720d0b9b.tar.bz2
ger2err-d746b39983b43dbb117da8ba41dd206d720d0b9b.zip
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.
-rwxr-xr-xger2err75
1 files 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))))