Separate repository line formatting into format-repository
This way people can override this function in their RC files, and specify what information they would like to see where. They would do this with, for example: ,---- | (set! format-repository | (lambda (name pushable pullable clean? updated) | (format #t "~a: ~d up; ~d down; ~a. Updated ~a\n" | name pushable pullable (if clean? "clean" "dirty") | updated))) `---- To turn each line into the like of: ,---- | gitto: 1 up; 0 down; dirty. Updated 4 months ago `----
This commit is contained in:
parent
77513487aa
commit
fc17fbd0e0
1 changed files with 7 additions and 4 deletions
|
@ -114,6 +114,11 @@ gitto [options]
|
|||
(display "Not a registered repository."))
|
||||
(newline))
|
||||
|
||||
(define (format-repository name pushable pullable clean? updated)
|
||||
(format
|
||||
#t "~a:~15t~d to push, ~d to pull and is ~a. Last update: ~a\n"
|
||||
name pushable pullable (if clean? "clean" "dirty") updated))
|
||||
|
||||
(define (git-revs-to-push)
|
||||
"Check how many commits should be pushed upstream."
|
||||
(let* ((pipe (open-input-pipe
|
||||
|
@ -159,10 +164,8 @@ to the tracked files. Utracked files will not register."
|
|||
(numdown (git-revs-to-pull))
|
||||
(clean? (git-clean?))
|
||||
(lastupdate (git-last-update)))
|
||||
(format
|
||||
#t "~a:~15t~d to push, ~d to pull and is ~adirty. Last update: ~a\n"
|
||||
(basename repo) numup numdown (if clean? "not " "")
|
||||
lastupdate)))
|
||||
(format-repository (basename repo) numup numdown clean?
|
||||
lastupdate)))
|
||||
(format #t "~a:~15tnot found at ~s\n" (basename repo) repo)))
|
||||
repositories))
|
||||
|
||||
|
|
Loading…
Reference in a new issue