diff --git a/README.md b/README.md index bcba960..5d9b6a8 100644 --- a/README.md +++ b/README.md @@ -43,9 +43,10 @@ the content of The Quran in multiple languages. *Usage* Usage: quran-json pull [OPTIONS] - -l, --locale LOCALE ar, en, pt, fa, nl, fr, or it (default: en) - -r, --replace Replace existing JSON files (default: no) - -u, --update Only update the surah metadata (implies -r, default: no) + -l, --locale LOCALE ar, en, pt, fa, nl, fr, or it (default: en) + -r, --replace Replace existing JSON files (default: no) + -u, --update Replace surah metadata with an updated copy (implies -r, default: no) +

Thanks @@ -53,12 +54,12 @@ the content of The Quran in multiple languages. First and foremost, Alhamdulillah. -Thanks to the following websites for making the content available to download: +Thanks to the following websites for providing the downloadable content: * https://searchtruth.com for the original Arabic, and the Italian translation. * https://quran.com for the English, Farsi, Portuguese, Dutch, and French translations. -And thanks to the translators of the content: +And sincere thanks to the translators of the content: * _Dr. Mustafa Khattab_ for the English translation. * _Hussein Taji Kal Dari_ for the Farsi translation. @@ -72,4 +73,4 @@ And thanks to the translators of the content: The "source code" is released under the [GPL](./LICENSE) license.
-The content is copyrighted to the translators (named above). +The content is copyrighted to the translators (listed above). diff --git a/lib/quran-json/quran/json/pull.rb b/lib/quran-json/quran/json/pull.rb index f49bca9..0d30be1 100644 --- a/lib/quran-json/quran/json/pull.rb +++ b/lib/quran-json/quran/json/pull.rb @@ -15,20 +15,35 @@ class Quran::JSON::Pull def self.cli(argv) op = nil - options = Ryo({locale: "en", replace: false, update: false}) - OptionParser.new(nil, 26, " " * 2) do |o| - o.banner = "Usage: quran-json pull [OPTIONS]" + result = Ryo({locale: "en", replace: false, update: false}) + OptionParser.new(nil, 22, " " * 2) do |o| op = o - o.on("-l", "--locale LOCALE", "ar, en, pt, fa, nl, fr, or it (default: en)") - o.on("-r", "--replace", "Replace existing JSON files (default: no)") - o.on("-u", "--update", "Only update the surah metadata (implies -r, default: no)") - end.parse(argv, into: options) - options + op.banner = "Usage: quran-json pull [OPTIONS]" + cli_options.each { op.on(*_1) } + end.parse(argv, into: result) + result rescue puts op.help exit end + def self.cli_options + [ + [ + "-l", "--locale LOCALE", + "ar, en, pt, fa, nl, fr, or it (default: en)" + ], + [ + "-r", "--replace", + "Replace existing JSON files (default: no)" + ], + [ + "-u", "--update", + "Replace surah metadata with an updated copy (implies -r, default: no)" + ] + ] + end + def initialize(options) @options = options @source = sources[options.locale]