cli

Function cli 

Source
pub async fn cli(
    minor_contracts_links: &BTreeMap<String, String>,
    public_tenders_links: &BTreeMap<String, String>,
) -> AppResult<()>
Expand description

Parses command-line arguments and executes the download command.

This function handles two subcommands:

  • cli: Manual CLI with default configuration (cleanup always enabled)
  • toml: Run using a TOML configuration file (cleanup configurable)

Both subcommands execute the same workflow for downloading and processing procurement data:

  1. Parses CLI arguments (procurement type, period range, cleanup options)
  2. Filters available links by the specified period range
  3. Downloads ZIP files from the filtered URLs
  4. Extracts ZIP archives to access XML/Atom files
  5. Parses XML/Atom content and converts to Parquet format
  6. Performs cleanup if requested

§Arguments

  • minor_contracts_links - Map of period strings (e.g., “202301”) to minor contracts download URLs
  • public_tenders_links - Map of period strings (e.g., “202301”) to public tenders download URLs

§Returns

Returns Ok(()) if all operations complete successfully. Returns an error if:

  • Invalid period ranges are specified
  • Network requests fail
  • File I/O operations fail
  • XML parsing fails