summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2016-09-30 18:29:53 +0200
committerrekado <rekado@elephly.net>2016-09-30 18:52:19 +0200
commit73f1ab5b5f915c7191eeb152a04c6b3057cb021e (patch)
tree38363d6472af82b7a0083be59974ea6c9f69886a
parent1ac5e832b5ab0f099f25f3087c29cc0bf104dfcc (diff)
Add "offset" and "frets" options.
-rw-r--r--scales/ui.scm17
1 files changed, 13 insertions, 4 deletions
diff --git a/scales/ui.scm b/scales/ui.scm
index 9382b24..b95d5d9 100644
--- a/scales/ui.scm
+++ b/scales/ui.scm
@@ -40,7 +40,9 @@
(format (single-char #\f) (value #t))
(tuning (single-char #\t) (value #t))
(scale (single-char #\s) (value #t))
- (root (single-char #\r) (value #t))))
+ (root (single-char #\r) (value #t))
+ (offset (single-char #\o) (value #t))
+ (frets (single-char #\n) (value #t))))
(options (getopt-long args option-spec))
(help-wanted (option-ref options 'help #f))
(version-wanted (option-ref options 'version #f))
@@ -51,7 +53,9 @@
(scale (call-with-input-string
(option-ref options 'scale "aeolian")
read))
- (root (option-ref options 'root "c")))
+ (root (option-ref options 'root "c"))
+ (offset (option-ref options 'offset "0"))
+ (frets (option-ref options 'frets "7")))
(if (or version-wanted help-wanted)
(begin
(if version-wanted
@@ -71,11 +75,16 @@ scales [options]
of steps, e.g. \"(1 2 2 2 1 2 2)\".
-r, --root=NOTE The root note of the scale, e.g. \"fis\" for
f sharp. Defaults to \"c\".
-
+ -o, --offset=NUMBER The first fret to be drawn.
+ Defaults to 0.
+ -n, --frets=NUMBER The number of frets to be drawn.
+ Defaults to 7.
")))
(let ((scale (lookup-scale scale))
(tuning (lookup-tuning tuning))
(root (string->symbol root))
+ (offset (string->number offset))
+ (frets (string->number frets))
(show (case (string->symbol format)
((svg) (compose display svg-fretboard))
(else print-fretboard))))
@@ -86,4 +95,4 @@ scales [options]
(for-each show (map (lambda (group)
(fretboard group (scale root)))
tuning))
- (show (fretboard tuning (scale root))))))))
+ (show (fretboard tuning (scale root) frets offset)))))))