aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2014-01-28 23:38:07 +0100
committerGravatar Tom Willemse2014-01-28 23:38:07 +0100
commit3036734e4b7c6bbe57c66393aa5d2937b8c1558c (patch)
treee9cc1e2f259484cbf1b2eea5028c734763d9db7d
parent0272a7d17e861a7fcff4791c4c33a76722815016 (diff)
downloadgitto-3036734e4b7c6bbe57c66393aa5d2937b8c1558c.tar.gz
gitto-3036734e4b7c6bbe57c66393aa5d2937b8c1558c.zip
Extract hooks init from config
-rw-r--r--gitto/main.scm36
1 files changed, 20 insertions, 16 deletions
diff --git a/gitto/main.scm b/gitto/main.scm
index 5ce6a47..693ae2d 100644
--- a/gitto/main.scm
+++ b/gitto/main.scm
@@ -220,12 +220,29 @@ which no longer point to a git repository."
"Show the template specified in `global-config'."
(write-config global-config))
+(define-command (hooks #:optional sub repository)
+ "Manage your repositories' hooks."
+ "Usage: gitto hooks init [repository]
+
+Installs the configured hooks into each repository or the given
+repository."
+ (cond
+ ((equal? sub "init")
+ (let ((hookwrapper
+ (lambda (r)
+ (unless (member (repo-name r) config-exclusion-list)
+ (install-hooks (repo-location r))))))
+ (if repository
+ (if (known? repository)
+ (hookwrapper (make <repository> repository))
+ (format #t "Unknown repository: ~a~%" repository))
+ (for-each hookwrapper repositories))))))
+
(define-command (config #:optional sub repository)
"Manage your repositories' configurations."
"Usage: gitto config
gitto config global
gitto config update [repository]
- gitto config hooks [repository]
The first form prints the configurations for each registered
repository.
@@ -238,10 +255,7 @@ The third form merges the template in and existing configurations,
overwriting settings when necessary. The repositories in the
`config-exclusion-list' will be skipped. If REPOSITORY is specified it
only updates the configuration for that repository. *Note:* This is a
-destructive operation, you should be mindful.
-
-The fourth form installs the configured hooks into each repository or
-the given repository."
+destructive operation, you should be mindful."
(cond
((not sub)
(for-each (lambda (repo)
@@ -252,17 +266,7 @@ the given repository."
(newline))
repositories))
((equal? sub "global") (show-global-config))
- ((equal? sub "update") (update-config repository))
- ((equal? sub "hooks")
- (let ((hookwrapper
- (lambda (r)
- (unless (member (repo-name r) config-exclusion-list)
- (install-hooks (repo-location r))))))
- (if repository
- (if (known? repository)
- (hookwrapper (make <repository> repository))
- (format #t "Unknown repository: ~a~%" repository))
- (for-each hookwrapper repositories))))))
+ ((equal? sub "update") (update-config repository))))
(define (update-repo-config repo)
"Merge the configured configuration with REPO's configuration.