mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-27 06:42:14 -05:00
ui: 'package->recutils' accurately honors the number of columns.
* guix/ui.scm (package->recutils)[width*]: New variable. Use it instead of WIDTH.
This commit is contained in:
parent
29ff6d9fcc
commit
069d43a765
1 changed files with 7 additions and 2 deletions
|
@ -855,11 +855,16 @@ (define (string->recutils str)
|
|||
(define* (package->recutils p port #:optional (width (%text-width)))
|
||||
"Write to PORT a `recutils' record of package P, arranging to fit within
|
||||
WIDTH columns."
|
||||
(define width*
|
||||
;; The available number of columns once we've taken into account space for
|
||||
;; the initial "+ " prefix.
|
||||
(if (> width 2) (- width 2) width))
|
||||
|
||||
(define (dependencies->recutils packages)
|
||||
(let ((list (string-join (map package-full-name
|
||||
(sort packages package<?)) " ")))
|
||||
(string->recutils
|
||||
(fill-paragraph list width
|
||||
(fill-paragraph list width*
|
||||
(string-length "dependencies: ")))))
|
||||
|
||||
(define (package<? p1 p2)
|
||||
|
@ -901,7 +906,7 @@ (define (package<? p1 p2)
|
|||
(format port "~a~2%"
|
||||
(string->recutils
|
||||
(string-trim-right
|
||||
(parameterize ((%text-width width))
|
||||
(parameterize ((%text-width width*))
|
||||
(texi->plain-text
|
||||
(string-append "description: "
|
||||
(or (and=> (package-description p) P_)
|
||||
|
|
Loading…
Reference in a new issue