quran-go

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

commit c0e271a69a2e817bf75c8ad79a1fc93aa1b868c9
parent 935c723eac7ed9b2a757a8b716ee084727c7ecc5
Author: Agastya <me@hanabi.in>
Date:   Sat,  7 May 2022 22:33:06 +0000

Update software version, rm the functions which was printing help, hard-coded man page in help.

Diffstat:
Msrc/print/about.go | 4+++-
Msrc/print/details.go | 4+++-
Dsrc/print/fns.go | 19-------------------
Msrc/print/help.go | 92++++++++++++++++++++++++++++++++++++++++++-------------------------------------
Msrc/print/version.go | 4+++-
Msrc/quran-com/http-get.go | 2+-
6 files changed, 59 insertions(+), 66 deletions(-)

diff --git a/src/print/about.go b/src/print/about.go @@ -1,5 +1,7 @@ package print +import "fmt" + func About() { - p("`quran' prints Qur'an chapters and verses right in the terminal.") + fmt.Println("`quran' prints Qur'an chapters and verses right in the terminal.") } diff --git a/src/print/details.go b/src/print/details.go @@ -1,5 +1,7 @@ package print +import "fmt" + func Details() { - p("`quran' fetches verses and translation information from <quran.com>'s v4 API.") + fmt.Println("`quran' fetches verses and translation information from <quran.com>'s v4 API.") } diff --git a/src/print/fns.go b/src/print/fns.go @@ -1,19 +0,0 @@ -package print - -import "fmt" - -func p(a string) (n int, err error) { - return fmt.Println(a) -} -func pt(a string) (n int, err error) { - return fmt.Println("\t", a) -} -func ptt(a string) (n int, err error) { - return fmt.Println("\t\t", a) -} -func ptn(a string) (n int, err error) { - return fmt.Println("\t", a, "\n\n") -} -func pttn(a string) (n int, err error) { - return fmt.Println("\t\t", a, "\n") -} diff --git a/src/print/help.go b/src/print/help.go @@ -1,64 +1,70 @@ package print +import "fmt" + func Help() { - p("QURAN\n\n") + msg := ` +QURAN(1) General Commands Manual QURAN(1) [26/950] - p("NAME") - ptn("quran - fetch various quran translations right in the terminal.") +NAME + quran - fetch various Qur'an translations right in the terminal. - p("SYNOPSIS") - ptn("quran [-delay[=<millisecs>]] [-decorate] [-trans[=<translation-id>]] <command> [<args>]") +SYNOPSIS + quran [-delay delay-ms] [-decorate] [-trans trans-id] [command|args] - p("DESCRIPTION") - pt("`quran' fetches Qur'an translations right in the terminal.") - ptn("`quran' is not 'bug compatible' with `quran.py', as this software handles parsing input differently.") +DESCRIPTION + quran fetches Qur'an chapter and verse translations right in the + terminal. quran is not 'bug compatible' with quran.py, as this software + parses input differently. - p("OPTIONS") - pt("-decorate") - ptt("Specify if the chapters and verses should be decorated xor not.") - ptt("Defaults to false.") + The options are as follows: - pt("-delay <delay-ms>") - ptt("Specify <delay-ms> in milliseconds, the delay between fetching aayahs.") - ptt("I advice using at least 500.") - ptt("Default is 1000.") // Should the delay be *only* between verses? Or *any* API call? + -delay delay-ms + Specify delay-ms in milliseconds, the delay between fetching + verses. I advice using at least 500. Default is 1000. - pt("-trans <translation-id>") - ptt("Select which translation to use, for fetching the verses.") - pttn("Default id is 131, corresponding to Dr. Mustafa Khattab, the Clear Quran.") - pttn("Use `quran ls-translations' to see available translations.") + -decorate + Decorate the chapters and verses. - p("COMMANDS") - pt("about") - ptt("Prints basic description about `quran'.") + -trans trans-id + Select which translation to use, for fetching the verses. + Default trans-id is 131, corresponding to Dr. Mustafa Khattab, + the Clear Quran. Use quran ls-translations to see available + translations. - pt("details") - ptt("Prints information about the source of the data.") +COMMANDS + about Print basic description about quran. - pt("version") - ptt("Prints version of `quran'.") + details + Print basic information about the source of the verses. - pt("ls-translations") - pttn("Prints available translations, which can be specified with the `-trans' flag.") + ls-translations + Print available translations, which can be specified with the + -trans flag. - p("ARGUMENTS") - ptn("Without specifying any commands, arguemnt is of the type <chapter:[verse1[-verse2]]>") + version + Print current version of quran. - p("LICENSE") - pt("This software is licensed under GNU Affero General Public License v3.") - pt("Please see <https://www.gnu.org/licenses/agpl-3.0.txt>") - ptn("for what you are allowed to do with this software's source code.") +ARGUMENTS + Without specifying any commands, argument is of the type + <chapter:[verse1[-verse2]]>. - p("AUTHORS") - pt("quran was written by acagastya.") - ptn("Running `git blame' on the source code of this software can show the authors of project.") +LICENSE + This software is licensed under the GNU Affero General Public License v3. + Please see <https://www.gnu.org/licenses/agpl-3.0/txt> for what you are + allowed to do with this software's source code. - p("REPORTING ERRORS") - pt("Please do NOT call errors as bugs. Any incorrect behaviour of the software is an ERROR.") - pt("Report issues to <me+git@hanabi.in>.") - ptn("Additionally, if you wish to submit changes/error fixes, please send a git-patch to the same email.") +AUTHORS + Original implementation by acagastya <me+git@hanabi.in>. - p("Quran v1.0.0\t\tMay 01, 2022\t\tacagastya") +REPORTING ERRORS + Please do NOT call errors as bugs. Any incorrect behaviour of the + software is an ERROR. Report errors to + acagastya <me+git@hanabi.in>. Additionally, if you wish to submit + changes/error fixes, please send a git-format-patch(1) to the same email. + May 8, 2022 +` + fmt.Print(msg) } diff --git a/src/print/version.go b/src/print/version.go @@ -1,5 +1,7 @@ package print +import "fmt" + func Version() { - p("quran v1.0.0") + fmt.Println("quran v1.0.1") } diff --git a/src/quran-com/http-get.go b/src/quran-com/http-get.go @@ -16,7 +16,7 @@ func HttpGet(endpoint string, st interface{}) (err error) { return err } - req.Header.Set("User-Agent", "git.hanabi.in/quran-go v1.0.0") + req.Header.Set("User-Agent", "git.hanabi.in/quran-go v1.0.1") resp, err := client.Do(req) if err != nil {