hadith-cli
Version:
This is a CLI for hadith on terminal
1 lines • 1.23 kB
JavaScript
const gradient=require("gradient-string"),{hadithVolume1:hadithVolume1,hadithVolume2:hadithVolume2}=require("../books/HadithVolumes"),{DisplayMessage:DisplayMessage}=require("./displayMessage"),requestProcessor=async(e,a,o)=>{if(1===Number(e)){const e=(await hadithVolume1())[0].books[Number(a-1)];if(e){const a=e.name,t=e.hadiths[o-1];return DisplayMessage(a,t)}return console.log(gradient("cyan","pink").multiline("Oh no, we haven't got the hadith you are looking for, probably you can raise a PR for that? here is the repo - https://github.com/AshifMohammad/hadith.cli"))}if(2===Number(e)){const e=(await hadithVolume2())[0].books[Number(a-1)];if(e){const a=e.name,t=e.hadiths[o-1];return DisplayMessage(a,t)}return console.log(gradient("cyan","pink").multiline("Oh no, we haven't got the hadith you are looking for, probably you can raise a PR for that? here is the repo - https://github.com/AshifMohammad/hadith.cli"))}return console.log(gradient("cyan","pink").multiline("Oh no, we haven't got the hadith, only have Volume 1 and 2 for now, In Sha Allah we will update it meanwhile here is the repo if you care to raise a PR - https://github.com/AshifMohammad/hadith.cli"))};module.exports={requestProcessor:requestProcessor};