scripturetool

Go to project on Github

Description

Command line tool for accessing Latter-day Saint scripture, designed for faster lookup.
Scripture resource files are stored as g-zipped json and accessed directly by reference. References are displayed in less by default, but the -o flag redirects output to stdout.
Flags are also available to display footnotes and headings, or modify formatting.

Usage

./scripturetool [flags] <reference>
Reference:
  "Book chap:vs"         or 
  "Book chap"            (prints whole chapter) or
  "Book chap-range"      (doesn't accept verse listing)
Book Name:
  "1 Corinthians"        (by name)
  "1-cor"                (abbreviated: see below)
  "{Matt,Mark,Luke}"     (listed: abbreviated or not)--Not yet implemented
  "[OT]"                 (by class)
Chapter Number:
  "2"                    (number)
  "3-5"                  (range: don't list verses after)
  "20,84,100"            (listed)
  "*"                    (all chapters, same as not listing verse)--Not yet implemented
Verse Numbers:
  "2"                    (number)
  "3-5"                  (range)
  "77,79"                (listed)
  Using * as a chapter will indicate all chapters in the book: John *:12 will indicate
    the 12th verse of every chapter of John (having at least 12 verses)
  Using * as a verse is equivalent to listing the chapter number alone: John 17:* is
    equivalent to John 17
                

Backend Details

Grammar

The following grammar defines the structure of a valid scripture reference.

<start>           ::= <reference> <referencelist> ';'?
<referencelist>   ::= ';' <reference> <refrencelist> | ';' | <lambda>
<reference>       ::= <book> | <book> (<chapter> <chapterlist> | '*') 
                      | <book> (<chapter> | '*') ':' (<verse> <verselist> | '*')
<book>            ::= [::alnum::[]] <string> | '*'
<string>          ::= []-::alpha::] <string> | <lambda>
<lambda>          ::= ''
<integer>         ::= [0-9] <integer> | <lambda>
<chapter>         ::= <integer> | <integerrange>
<chapterlist>     ::= ',' <chapter> <chapterlist> | <lambda>
<integerrange>    ::= <integer> '-' <integer>
<verse>           ::= <integer> | <integerrange>
<verselist>       ::= ',' <verse> <verselist> | <lambda>
                

Abbreviations

Abbreviaitons are available so that users don't have to type entire book names, since the point of the tool is to enhance lookup speed.

OLD TESTAMENT   [ot]    NEW TESTAMENT   [nt]   
Genesis         gen     Matthew         matt   
Exodous         ex      Mark            mark   
Leviticus       lev     Luke            luke   
Deuteronomy     deut    John            john   
Numbers         num     Acts            acts   
Joshua          jos     Romans          rom    
Judges          judg    1 Corinthians   1-cor  
Ruth            ruth    2 Corinthians   2-cor  
1 Samuel        1-sam   Galatians       gal    
2 Samuel        2-sam   Ephesians       eph    
1 Kings         1-kin   Philippians     philip 
2 Kings         2-kin   Colossians      col    
1 Chronicles    1-chr   1 Thessalonians 1-thes 
2 Chronicles    2-chr   2 Thessalonians 2-thes 
Ezra            ezra    1 Timothy       1-tim  
Nehemiah        neh     2 Timothy       2-tim  
Esther          esth    Titus           titus  
Job             job     Philemon        philem 
Psalms          ps      Hebrews         heb    
Proverbs        prov    James           jas    
Ecclesiastes    eccl    1 Peter         1-pet  
Song of Solomon song    2 Peter         2-pet  
Isaiah          isa     1 John          1-jn   
Jeremiah        jer     2 John          2-jn   
Lamentations    lam     3 John          3-jn   
Ezekiel         ezek    Jude            jude   
Daniel          dan     Revelation      rev    
Hosea           hosea                          
Joel            joel    BOOK OF MORMON  [bom]  
Amos            amos    1 Nephi         1-ne   
Obadiah         obad    2 Nephi         2-ne   
Jonah           jonah   Jacob           jacob  
Micah           micah   Enos            enos   
Nahum           nahum   Jarom           jarom  
Habakkuk        hab     Omni            omni   
Zephaniah       zeph    Words of Mormon w-of-m 
Haggai          hag     Mosiah          mosiah 
Zechariah       zech    Alma            alma   
Malachi         mal     Helaman         hel    
                        3 Nephi         3-ne   
PEARL OF        [pgp]   4 Nephi         4-ne   
  GREAT PRICE           Mormon          morm   
Moses           moses   Ether           ether  
Abraham         abr     Moroni          moro   
JS-Matthew      js-m                           
JS-History      js-h    DOCTRINE AND    [dc]   
Articles        a-of-f    COVENANTS            
  of Faith              Sections        dc     
                

Project Credits

Written in Go
Logging with the logrus package by sirupsen
Flags and subcommand management with the cobra package by spf13
Scripture resources scraped from ChurchOfJesusChrist.org/scriptures