diff --git a/bible-tools.scm b/bible-tools/bible-tools.scm similarity index 100% rename from bible-tools.scm rename to bible-tools/bible-tools.scm diff --git a/scripts/count-words.in b/scripts/count-words.in deleted file mode 100755 index 5ff7ef0..0000000 --- a/scripts/count-words.in +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env sh -exec guile -e '(@ (count-words) main)' -s "$0" "$@" -!# - -(define-module (word-counter) - #:use-module (bible-tools) - #:use-module (count-words) - #:use-module (srfi srfi-1) - #:use-module (srfi srfi-26) - #:export (main)) - -(define (show-meta txt) - (define (tabs w) (if (< (string-length (car w)) 7) "\t\t" "\t")) - (define (to-str w) (string-append (car w) ":" (tabs w) - (number->string (cdr w)) "\n")) - (for-each (compose display to-str) (count-words (map text txt)))) - -(define (help) - (display "Usage: count-words [book] [-c chapter] [-h] [-v]\n") - (display "\t-c chapter count the words in this chapter\n") - (display "\t-h display this help message\n") - (display "\t-v display the current version\n")) - -(define (version) - (display "count-words v1.0.0\n")) - -(define (main args) - (define flag? (cut member <> args)) - (define get (compose cadr flag?)) - (define-syntax conf - (syntax-rules (else) - ((_ (f e)... (else g)) (cond ((flag? f) e)... (else g))))) - (with-bible "jantzen" - (conf ("-h" (help)) - ("-v" (version)) - ("-c" - (call-with-chapter (cadr args) (get "-c") show-meta)) - (else (call-with-book (cadr args) show-meta))))) diff --git a/scripts/word-counter.in b/scripts/word-counter.in index 5ff7ef0..58050af 100644 --- a/scripts/word-counter.in +++ b/scripts/word-counter.in @@ -1,5 +1,5 @@ #! /usr/bin/env sh -exec guile -e '(@ (count-words) main)' -s "$0" "$@" +exec guile -e '(@ (word-counter) main)' -s "$0" "$@" !# (define-module (word-counter)