From 73f1ab5b5f915c7191eeb152a04c6b3057cb021e Mon Sep 17 00:00:00 2001 From: rekado Date: Fri, 30 Sep 2016 18:29:53 +0200 Subject: Add "offset" and "frets" options. --- scales/ui.scm | 17 +++++++++++++---- 1 file 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))))))) -- cgit v1.2.3