How prsh11/manga-cli works
Project type and purpose
• From the file tree and README, this is a single-file, command-line interface (CLI) tool named “manga-cli.”
• Purpose: fetch manga chapters from the web, package them (CBZ/PDF), and open them in a viewer (zathura).
File structure
• Top-level items:
• .gitignore, LICENSE, README.md – meta files
• manga-cli – the executable script (likely Bash)
• No frontend/backend split; it’s a standalone CLI wrapper orchestrating external utilities.
• No config directory or library code – it delegates parsing, downloading, conversion, and viewing to dependencies.
README for additional insights
• Dependencies: curl (HTTP client), pup (HTML parser), zathura (+ plugins for CBZ/PDF), imagemagick (image conversion)
• Installation instructions emphasize copying the manga-cli script into /usr/local/bin
• Workflow hints: fetch page → parse links → download images → convert/zip → open viewer
a. Main components
• User/Terminal
• manga-cli script (orchestrator)
• HTTP client (curl)
• HTML parser (pup)
• Image processing (imagemagick for PDF)
• Archive format support (zathura-cb for CBZ, zathura-pdf-mupdf)
• PDF/CBZ viewer (zathura)
• Local filesystem for temporary files (images, archives)
b. Relationships & interactions
1. User invokes manga-cli in a terminal.
2. manga-cli calls curl to download the manga chapter page.
3. Output HTML flows into pup, which extracts image URLs.
4. manga-cli loops over URLs, uses curl to fetch each image to disk.
5. Depending on user flags, manga-cli either:
• packages images into a .cbz (zip) and calls zathura-cb, or
• uses imagemagick to convert images into a .pdf and calls zathura-pdf-mupdf.
6. zathura opens the archive for reading.
c. Architectural patterns & principles
• “Pipe and filter”: the script chains simple command-line tools, each responsible for one task.
• Separation of concerns: parsing, downloading, packaging, and viewing are delegated.
• Stateless orchestration: manga-cli doesn’t maintain state beyond temporary files.
d. Relevant technologies/frameworks
• Bash (scripting language)
• curl (network I/O)
• pup (CSS-selector parsing)
• imagemagick (image→PDF)
• zip (CBZ creation)
• zathura + plugins (display)
Detail without over-splitting
• Even though there’s a single script, break it into logical sub-components (fetch, parse, download, package, view).
• Ephemeral filesystem storage as an explicit node.