<commit_before>"use strict";

// Ringo modules
const fs = require("fs");
const system = require("system");
const {Parser} = require("ringo/args");
const logger = require("ringo/logging").getLogger(module.id);

const {generateProject} = require("./lib/writer");

const main = function(args) {
    let contentDir, outputDir, staticDir, templateDir;

    if (args.length === 1) {
        if (fs.isDirectory(args[0])) {
            contentDir = fs.join(args[0], "content");
            outputDir = fs.join(args[0], "output");
            staticDir = fs.join(args[0], "static");
            templateDir = fs.join(args[0], "templates");
        }
    } else if (args.length === 2) {
        if (args[0] === "init") {
            const emptyProjectDir = args[1];
            if (!fs.isDirectory(emptyProjectDir)) {<commit_msg>Better error handling<commit_after>"use strict";

// Ringo modules
const fs = require("fs");
const system = require("system");
const {Parser} = require("ringo/args");
const logger = require("ringo/logging").getLogger(module.id);

const {generateProject} = require("./lib/writer");

const main = function(args) {
    let contentDir, outputDir, staticDir, templateDir;

    if (args.length === 1) {
        if (fs.isDirectory(args[0])) {
            contentDir = fs.join(args[0], "content");
            outputDir = fs.join(args[0], "output");
            staticDir = fs.join(args[0], "static");
            templateDir = fs.join(args[0], "templates");
        } else {
            logger.error("Cannot read directory {}", fs.absolute(args[0]));
            return 1;
        }
    } else if (args.length === 2) {
        if (args[0] === "init") {
            const emptyProjectDir = args[1];
            if (!fs.isDirectory(emptyProjectDir)) {
{'fraction_non_alphanumeric': 0.17319704713231118, 'fraction_numerical': 0.011357183418512209, 'mean_word_length': 2.822125813449024, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '687588', 'n_tokens_mistral': 533, 'n_tokens_neox': 525, 'n_words': 121}