diff options
author | Tom Willemse | 2014-03-02 00:12:58 +0100 |
---|---|---|
committer | Tom Willemse | 2014-03-02 00:12:58 +0100 |
commit | 53db54e71da298fca37e5ae10ca8295ba33af441 (patch) | |
tree | 39ada84f3b639e1c01a66ad5d21cf62ca27beab0 /gitto/main.scm | |
parent | 7a0c947c10ddfdb96751128ea6dcf0e8d3852ee9 (diff) | |
download | gitto-53db54e71da298fca37e5ae10ca8295ba33af441.tar.gz gitto-53db54e71da298fca37e5ae10ca8295ba33af441.zip |
Extract RC loading from main
Diffstat (limited to 'gitto/main.scm')
-rw-r--r-- | gitto/main.scm | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/gitto/main.scm b/gitto/main.scm index d790200..3a2a5b7 100644 --- a/gitto/main.scm +++ b/gitto/main.scm @@ -52,6 +52,15 @@ (for-each print-repository-location (sort repositories repository-location<?))) +(define (load-rc) + "Load the RC file for user customizations." + (let ((cfg (config-file "rc.scm"))) + (when (file-exists? cfg) + (save-module-excursion + (lambda () + (set-current-module (resolve-module '(gitto main))) + (primitive-load cfg)))))) + (define (maybe-install-hooks. repo) "Install hooks for REPO unless it's excluded." (unless (member (repo-name repo) config-exclusion-list) @@ -273,17 +282,12 @@ Displays version and some copyright information." (define (main args) "Parse the command line options and run the appropriate functions." - (let ((cfg (config-file "rc.scm"))) - (when (file-exists? cfg) - (save-module-excursion - (lambda () - (set-current-module (resolve-module '(gitto main))) - (primitive-load cfg)))) - - (let* ((command-spec (cdr (member "gitto" args string-suffix?))) - (command-specified? (not (eq? command-spec '()))) - (command (car (if command-specified? command-spec '("list"))))) - (if (command? command) - (apply (command-function command) - (if command-specified? (cdr command-spec) '())) - (format #t "Unknown command: ~a~%" (car command-spec)))))) + (load-rc) + + (let* ((command-spec (cdr (member "gitto" args string-suffix?))) + (command-specified? (not (eq? command-spec '()))) + (command (car (if command-specified? command-spec '("list"))))) + (if (command? command) + (apply (command-function command) + (if command-specified? (cdr command-spec) '())) + (format #t "Unknown command: ~a~%" (car command-spec))))) |