Skip to content

Instantly share code, notes, and snippets.

@samdphillips
Last active September 23, 2022 06:07
Show Gist options
  • Save samdphillips/82dddf57689ab1d9bcd3e53170610011 to your computer and use it in GitHub Desktop.
Save samdphillips/82dddf57689ab1d9bcd3e53170610011 to your computer and use it in GitHub Desktop.
#!/usr/bin/env racket
#lang racket
(require lens
net/http-easy
qi
racket/date
syntax/parse/define)
(current-print
(lambda (v)
(unless (void? v)
(pretty-print v))))
(define-syntax-parse-rule (define-key name:id)
(begin
(define name/l (lens-thrush cdr-lens (hash-ref-lens 'name)))
(define (name v) (lens-view name/l v))))
(define-key last-updated)
(define-key last-checked)
(define-qi-syntax-rule (timefmt fl)
(~> fl (seconds->date #f) (date->string #t)))
(match-define (vector argv) (current-command-line-arguments))
(~> ()
(get "https://pkgs.racket-lang.org/pkgs-all" #:close? #f #:stream? #t)
read-response
hash->list
sep
(pass (~> car (equal? argv)))
(-< values
(timefmt last-updated)
(timefmt last-checked)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment