CLI¶
cli
¶
Command line interface.
Provides the CLI for SUS using Typer with Rich-formatted output. Main commands: scrape, validate, init, and list. All commands use Rich for styled terminal output.
Classes¶
Functions¶
main
¶
main(version: bool | None = typer.Option(None, '--version', '-V', help='Show version and exit', callback=version_callback, is_eager=True)) -> None
SUS - Simple Universal Scraper for documentation sites.
scrape
¶
scrape(config: Path = typer.Option(..., '--config', '-c', help='Path to YAML config file', exists=True, file_okay=True, dir_okay=False, resolve_path=True), output: str | None = typer.Option(None, '--output', '-o', help='Override output directory'), verbose: bool = typer.Option(False, '--verbose', '-v', help='Verbose logging'), dry_run: bool = typer.Option(False, '--dry-run', help="Don't write any files (simulation mode)"), max_pages: int | None = typer.Option(None, '--max-pages', help='Limit number of pages to crawl', min=1), preview: bool = typer.Option(False, '--preview', help='Export dry-run JSON report')) -> None
Scrape documentation site using config file.
Loads configuration from YAML file and runs the scraper according to the specified rules. Use --dry-run to preview without writing files.
validate
¶
validate(config_path: Path = typer.Argument(..., help='Path to YAML config file to validate', exists=True, file_okay=True, dir_okay=False, resolve_path=True)) -> None
Validate a SUS configuration file.
Checks YAML syntax and validates all configuration fields against the schema. Displays detailed error messages if validation fails.
init
¶
init(output_path: Path | None = typer.Argument(None, help='Output path for generated config file (default: config.yaml)'), force: bool = typer.Option(False, '--force', '-f', help='Overwrite existing file')) -> None
Create a new SUS configuration file interactively.
Prompts for basic configuration options and generates a minimal YAML config file. Use this as a starting point for your scraper.
list_examples
¶
List example configurations from the examples/ directory.
Shows all available example configs with their descriptions and start URLs. Use these as templates for your own configurations.