lunchtime fix
This commit is contained in:
parent
54269898fc
commit
1c1f4b7dbf
@ -8,36 +8,25 @@
|
||||
|
||||
|
||||
(defn parse-rfc-822 [inpu]
|
||||
"Split an RFC 822 payload up. Doesn't handle comments or multi-entries"
|
||||
(do (def keys {})
|
||||
(def key None)
|
||||
(def val None)
|
||||
(for [x (.splitlines inpu)]
|
||||
(if (>= (.find x ":") 0)
|
||||
(def key None)
|
||||
(def val None)
|
||||
(for [x (.splitlines inpu)]
|
||||
(if (!= x "")
|
||||
(if (!= (index x 0) " ")
|
||||
(do (def kv (.split x ":" 1))
|
||||
(def key (.strip (index kv 0)))
|
||||
(set-index keys key (.strip (index kv 1))))
|
||||
(set-index keys key (+ (index keys key) "\n" (.strip x)))))
|
||||
(dict keys)))
|
||||
(def key (.strip (index kv 0)))
|
||||
(set-index keys key (.strip (index kv 1))))
|
||||
(set-index keys key (+ (index keys key) "\n" (.strip x))))))
|
||||
(dict keys)))
|
||||
|
||||
|
||||
(defn get-info [package]
|
||||
"Get info on a Debian package"
|
||||
(parse-rfc-822 (.show apt-cache package)))
|
||||
|
||||
|
||||
(def data (get-info package))
|
||||
|
||||
|
||||
(defn get-line [data key]
|
||||
"Get the first line if a multi-line key"
|
||||
(index (.split (index data key) "\n") 0))
|
||||
|
||||
|
||||
(if (in "Description" data)
|
||||
(def descr (get-line data "Description"))
|
||||
(def descr (get-line data "Description-en")))
|
||||
|
||||
|
||||
(print "The maintainer for" package "is" (index data "Maintainer"))
|
||||
(print package "is a(n)" descr)
|
||||
(print "")
|
||||
(print package "is a(n)" (index data "Description-en"))
|
||||
|
Loading…
Reference in New Issue
Block a user