default-behaviour.go (857B)
1 package driver 2 3 import ( 4 c "git.hanabi.in/gitbox/quran-go/src/cliinput" 5 d "git.hanabi.in/gitbox/quran-go/src/display" 6 f "git.hanabi.in/gitbox/quran-go/src/fetch" 7 p "git.hanabi.in/gitbox/quran-go/src/print" 8 u "git.hanabi.in/gitbox/quran-go/src/utils" 9 ) 10 11 func defaultBehaviuor() { 12 13 chapterVerseRange, translationID, delay, shouldDecorate := c.ParseFlags() 14 15 chapter, verse1, verse2, err := u.ParseInput(chapterVerseRange) 16 if err != nil { 17 p.Err(err) 18 } 19 20 translationDetails, err := f.TranslationDetails(translationID) 21 if err != nil { 22 p.Err(err) 23 } 24 author := translationDetails.AuthorName 25 26 lastVerse, err := u.CheckVerseRange(chapter, verse1, verse2) 27 if err != nil { 28 p.Err(err) 29 } 30 31 if verse1 == 0 { // Print whole chapter. 32 verse1, verse2 = 1, lastVerse 33 } 34 35 d.Verses(chapter, verse1, verse2, author, translationID, delay, shouldDecorate) 36 37 }