git-difme

git do it for me - ricketyspace.net/git-difme
git clone git://git.ricketyspace.net/git-difme.git
Log | Files | Refs

commit 5a411a9c030678d371297b32691da1f6b02c30e0
parent 140332256f2059be7b3a0fdcf082c3bb1f568df4
Author: rsiddharth <s@ricketyspace.net>
Date:   Sun, 10 Jul 2016 02:36:37 +0000

add configuration functions.

* git-difme.scm (load-config, get-config-path, get-difme-repos): new
  functions.

Diffstat:
git-difme.scm | 23+++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)

diff --git a/git-difme.scm b/git-difme.scm @@ -30,6 +30,29 @@ (close-pipe port) out-lst)) +;;;; configuration +(define (load-config path) + "load configuration file from PATH. + +errors out if PATH does not exists." + (if (file-exists? path) + (load path) + (error "config not found at" path))) + +(define (get-config-path) + "return configuration file path as a string." + (string-append (getenv "HOME") "/.config/git-difme/config")) + +(define (get-difme-repos) + "return difme repos returned by `difme-repos` function. + +`difme-repos` is defined in the configuration file; this function +loads the configuration file and then evals the `difme-repos` +function." + (let ((path (get-config-path))) + (load-config path) + (eval '(difme-repos) (interaction-environment)))) + ;;;; main (define (main srcs) srcs)