#include <iostream>
#include <filesystem>
#include "../include/argparse.hpp"
#include "../include/generator.hpp"

int main(int argc, char* argv[]) {
    try {
        Args args = parse_args(argc, argv);
        std::filesystem::path src(args.source);
        if (!std::filesystem::exists(src)) {
            std::cerr << "Source does not exist: " << args.source << std::endl;
            return 1;
        }
        if (std::filesystem::is_regular_file(src)) {
            generate_file_code(args.source, args.dest, args.silent);
        } else if (std::filesystem::is_directory(src)) {
            generate_folder_code(args.source, args.dest, args.silent);
        } else {
            std::cerr << "Source is neither a file nor a directory: " << args.source << std::endl;
            return 1;
        }
    } catch (const std::exception& ex) {
        std::cerr << ex.what() << std::endl;
        return 1;
    }
    return 0;
} 