|  | @@ -32,7 +32,7 @@ struct Cli {
 | 
	
		
			
				|  |  |      #[arg(short, long, default_value = "ESV")]
 | 
	
		
			
				|  |  |      version: String,
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    /// User Agent
 | 
	
		
			
				|  |  | +    /// Update Firefox User Agent version
 | 
	
		
			
				|  |  |      #[arg(short, long, action=clap::ArgAction::SetTrue)]
 | 
	
		
			
				|  |  |      agent_update: bool,
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -50,15 +50,15 @@ enum Commands {
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      /// Extract information from cached files
 | 
	
		
			
				|  |  |      Extract {
 | 
	
		
			
				|  |  | -        /// Count
 | 
	
		
			
				|  |  | -        #[arg(short, long)] // , default_value = "5")]
 | 
	
		
			
				|  |  | +        /// How many chapters to extract (default is all)
 | 
	
		
			
				|  |  | +        #[arg(short, long)] 
 | 
	
		
			
				|  |  |          count: Option<u32>,
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        /// Output file
 | 
	
		
			
				|  |  | +        /// JSON Output file
 | 
	
		
			
				|  |  |          #[arg(short, long)]
 | 
	
		
			
				|  |  |          output: Option<PathBuf>,
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        /// SQL output
 | 
	
		
			
				|  |  | +        /// SQL output file
 | 
	
		
			
				|  |  |          #[arg(short, long)]
 | 
	
		
			
				|  |  |          sql: Option<PathBuf>,
 | 
	
		
			
				|  |  |      },
 | 
	
	
		
			
				|  | @@ -89,6 +89,8 @@ static BOOKS: LazyLock<Vec<&str>> = LazyLock::new(|| {
 | 
	
		
			
				|  |  |      ])
 | 
	
		
			
				|  |  |  });
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +// Note: There are more books in the Catholic bible that aren't listed here.
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  #[allow(unused)]
 | 
	
		
			
				|  |  |  static BOOK_NAMES: LazyLock<Vec<&str>> = LazyLock::new(|| {
 | 
	
		
			
				|  |  |      Vec::from([
 | 
	
	
		
			
				|  | @@ -173,7 +175,7 @@ fn find_files(base_dir: &str, version: &str) -> Vec<String> {
 | 
	
		
			
				|  |  |      for path in paths {
 | 
	
		
			
				|  |  |          if let Ok(dir) = path {
 | 
	
		
			
				|  |  |              let filename = dir.file_name().to_string_lossy().to_string();
 | 
	
		
			
				|  |  | -            
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              // Currently, I don't have anywhere to store the introduction part.
 | 
	
		
			
				|  |  |              if filename.contains("INTRO") {
 | 
	
		
			
				|  |  |                  continue;
 | 
	
	
		
			
				|  | @@ -208,25 +210,19 @@ fn find_files(base_dir: &str, version: &str) -> Vec<String> {
 | 
	
		
			
				|  |  |      result
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -// And maybe:
 | 
	
		
			
				|  |  | -// https://www.bible.com/bible/2692/GEN.1.NASB2020
 | 
	
		
			
				|  |  | -// https://www.bible.com/bible/1/GEN.1.KJV
 | 
	
		
			
				|  |  | -// https://www.bible.com/bible/2692/GEN.1.NASB2020
 | 
	
		
			
				|  |  | -// https://www.bible.com/bible/111/GEN.1.NIV
 | 
	
		
			
				|  |  | -// https://www.bible.com/bible/821/GEN.1.YLT98
 | 
	
		
			
				|  |  | -// Catholic
 | 
	
		
			
				|  |  | -// https://www.bible.com/bible/42/GEN.1.CPDV
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -// Audio
 | 
	
		
			
				|  |  | -// https://www.bible.com/audio-bible/59/GEN.1.ESV
 | 
	
		
			
				|  |  | -// <script type="application/ld+json">{"@context":"https://schema.org","@type":"AudioObject","mainEntityOfPage":{"@type":"WebPage","@id":"https://www.bible.com/audio-bible/59/GEN.1.ESV"},"headline":"Audio Bible: Listen to Genesis 1 English Standard Version 2016 ESV","contentUrl":"https://audio-bible-cdn.youversionapi.com/1/32k/GEN/1-9dcefc68c6f7244489f59475fc7a1866.mp3?version_id=59",
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -// https://www.bible.com/verse-of-the-day
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |  fn main() -> Result<()> {
 | 
	
		
			
				|  |  |      let mut config = config::read_config(CONFIG_FILE)?;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      let cli = Cli::parse();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if !cli.work.is_dir() {
 | 
	
		
			
				|  |  | +        println!("The given work directory {:?} doesn't exist.", cli.work);
 | 
	
		
			
				|  |  | +        println!("Sorry, you'll need to create it to use it.");
 | 
	
		
			
				|  |  | +        // Display help.
 | 
	
		
			
				|  |  | +        let _show_help: Cli = Cli::parse_from(["--help"]);
 | 
	
		
			
				|  |  | +        return Ok(());
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      // println!("Work Dir: {:?}", cli.work);
 | 
	
		
			
				|  |  |      // println!("Bible: {:?}", cli.bible);
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -250,7 +246,7 @@ fn main() -> Result<()> {
 | 
	
		
			
				|  |  |              println!("User agent OK.");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | + 
 | 
	
		
			
				|  |  |      match &cli.command {
 | 
	
		
			
				|  |  |          Some(Commands::Fetch { delay }) => {
 | 
	
		
			
				|  |  |              let client = reqwest::blocking::Client::builder()
 | 
	
	
		
			
				|  | @@ -479,12 +475,25 @@ fn main() -> Result<()> {
 | 
	
		
			
				|  |  |              }
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        Some(Commands::Verse { fetch: _ }) => {
 | 
	
		
			
				|  |  | +        Some(Commands::Verse { fetch }) => {
 | 
	
		
			
				|  |  |              let client = reqwest::blocking::Client::builder()
 | 
	
		
			
				|  |  |                  .user_agent(&config.user_agent)
 | 
	
		
			
				|  |  |                  .build()?;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              println!("Verse of the day.");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if *fetch {
 | 
	
		
			
				|  |  | +                let filename = fetch::filename_from_url(VOD_URL)?;
 | 
	
		
			
				|  |  | +                let mut path = PathBuf::from(&cli.work);
 | 
	
		
			
				|  |  | +                path = path.join(filename);
 | 
	
		
			
				|  |  | +                if path.is_file() {
 | 
	
		
			
				|  |  | +                    println!("Removing file {:?}", path);
 | 
	
		
			
				|  |  | +                    std::fs::remove_file(path)?;
 | 
	
		
			
				|  |  | +                } else {
 | 
	
		
			
				|  |  | +                    println!("I don't see the file {:?} ?", path);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |              let result = fetch::fetch_cache(
 | 
	
		
			
				|  |  |                  cli.work
 | 
	
		
			
				|  |  |                      .as_os_str()
 |