aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2013-05-05 03:04:47 +0200
committerGravatar Tom Willemse2013-05-05 03:04:47 +0200
commitfc17fbd0e091357f87508b7afbb3f0b87b60594f (patch)
tree0c4f717a499bbeb5268179630ff49d5d3097cf6d
parent77513487aa995625fd7af1f9f78f6016e7058445 (diff)
downloadgitto-fc17fbd0e091357f87508b7afbb3f0b87b60594f.tar.gz
gitto-fc17fbd0e091357f87508b7afbb3f0b87b60594f.zip
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 `----
-rw-r--r--gitto/main.scm11
1 files changed, 7 insertions, 4 deletions
diff --git a/gitto/main.scm b/gitto/main.scm
index ae1ce58..a076182 100644
--- a/gitto/main.scm
+++ b/gitto/main.scm
@@ -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))