quran-go

Read Qur'an right in the terminal.
git clone http://git.hanabi.in/repos/quran-go.git
Log | Files | Refs | README | LICENSE

parse-flags.go (940B)


      1 package cliinput
      2 
      3 import (
      4 	"flag"
      5 
      6 	q "git.hanabi.in/gitbox/quran-go/src/quran-com"
      7 	t "git.hanabi.in/gitbox/quran-go/src/types"
      8 )
      9 
     10 // Supply runtime input.
     11 func ParseFlags() (chapterVerseRange string, translationID t.Trans, delay t.Delay, shouldDecorate bool) {
     12 
     13 	var transInt int
     14 	var delayUint float64
     15 
     16 	flag.IntVar(&transInt, "trans", q.DefaultTrans, "Specify translation ID of which translation to show.  Defaults to 131, corresponding to Dr. Mustafa Khattab, the Clear Quran.")
     17 
     18 	flag.Float64Var(&delayUint, "delay", q.DefaultDelay, "Minimum delay in milliseconds between fetching aayahs.  Defaults to 1000.")
     19 
     20 	flag.BoolVar(&shouldDecorate, "decorate", q.DefaultDecorate, "Specify if the chapters, or verses should be decorated.  Defaults to false.")
     21 
     22 	flag.Parse()
     23 
     24 	chapterVerseRange = flag.Arg(0)
     25 
     26 	translationID = t.Trans(transInt)
     27 	delay = t.Delay(delayUint)
     28 
     29 	return chapterVerseRange, translationID, delay, shouldDecorate
     30 
     31 }