import std.stdio; import std.string; // My classes import config.downloaderconfig; import sites.hentaicafe; import sites.nhentai; import inputhandler; void printHelp() { writeln(` Usage: -h Display this help message -b Batchmode -> Downloads all links in the given text file Download only one manga`); } void main(string[] args) { /* writeln(args); */ if(args.length < 2) { printHelp(); return; } if(args.length == 2) { // -h arg if(args[1] == "-h") { printHelp(); return; } // Direct link was supplied string url = args[1]; // Call the factory with the link that was supplied siteFactory(url); } else if(args.length >= 3) { // Batchmode import std.file : readText; string filename = args[2]; // Read all the links into memory string fileContents = readText(filename); // Transform fileContents into an array string[] urls = fileContents.split("\n"); // Sanitize the urls foreach(string url; urls) { // If the url is empty move on to the next if(strip(url) == "") continue; url = strip(url); } /* writeln(urls); */ // Call the factory siteFactory(urls); } }