From ea945c83faa9e067799cbae248d910d41b65c092 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sat, 1 Mar 2014 20:09:47 +0100 Subject: Reorder variables and procedures --- gitto/main.scm | 110 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 56 insertions(+), 54 deletions(-) diff --git a/gitto/main.scm b/gitto/main.scm index 1b9d742..0bd30a9 100644 --- a/gitto/main.scm +++ b/gitto/main.scm @@ -29,23 +29,28 @@ #:use-module (srfi srfi-1) #:export (main)) -(define config-exclusion-list '()) - -(define (storage-dir xdg-env fallback) - "Get the location where gitto stores information. - -XDG-ENV specifies which XDG environment variable should be looked at -and FALLBACK specifies the directory to use if XDG-ENV has not been -set in the current environment." - (let ((xdg (getenv xdg-env))) - (string-append - (or xdg (getenv "HOME")) (if xdg "" fallback) "/gitto"))) - (define (config-dir) (storage-dir "XDG_CONFIG_HOME" "/.config")) + (define (config-file file) (string-append (config-dir) "/" file)) + (define (data-dir) (storage-dir "XDG_DATA_HOME" "/.local/share")) + (define (data-file file) (string-append (data-dir) "/" file)) +(define (known? repo) + "Do we know REPO?" + (and (valid-repo? repo) (registered? repo))) + +(define (list-repository-locations) + "List the registered locations of repositories." + (for-each + (lambda (repo) + (display (repo-location repo)) + (newline)) + (sort repositories + (lambda (s1 s2) + (string