<commit_before>'use strict';

var node_path   = require('path');
var node_url    = require('url');
var fs          = require('fs-sync');
var pkg_helper  = require('../util/package');

exports.shorthands = {
    c: 'cwd'
};

exports.options = {
    cwd: {
        type: node_path,
        info: 'current working directories.',
        setter: function (cwd) {
            var done = this.async();
            var error;

            var dirs = cwd ? 
                cwd.split(',').map(function (c) {
                    return node_path.resolve(c);
                }) :

                [ process.cwd() ];

            dirs.map(function (dir) {
                var root = pkg_helper.repo_root(dir);

                if(root === null){
                    error = 'directory "' + dir + '" is not inside a project.';
                }

                return root;
            });

            if ( error ) {
                return done(error);
            }

            done(null, dirs);
        }
    },

    stop: {
        type: Boolean,
        info: 'with "--stop", cortex will unwatch directories.',
        default: false
    }
};

exports.info = 'Rebuild the current repository whenever watched files change.';

exports.usage = '{{name}} watch [options]';<commit_msg>#248: option/watch: remove deps on fs-sync<commit_after>'use strict';

var node_path   = require('path');
var node_url    = require('url');
var pkg_helper  = require('../util/package');

exports.shorthands = {
    c: 'cwd'
};

exports.options = {
    cwd: {
        type: node_path,
        info: 'current working directories.',
        setter: function (cwd) {
            var done = this.async();
            var error;

            var dirs = cwd ? 
                cwd.split(',').map(function (c) {
                    return node_path.resolve(c);
                }) :

                [ process.cwd() ];

            dirs.map(function (dir) {
                var root = pkg_helper.repo_root(dir);

                if(root === null){
                    error = 'directory "' + dir + '" is not inside a project.';
                }

                return root;
            });

            if ( error ) {
                return done(error);
            }

            done(null, dirs);
        }
    },

    stop: {
        type: Boolean,
        info: 'with "--stop", cortex will unwatch directories.',
        default: false
    }
};

exports.info = 'Rebuild the current repository whenever watched files change.';

exports.usage = '{{name}} watch [options]';
{'fraction_non_alphanumeric': 0.1345926800472255, 'fraction_numerical': 0.0011806375442739079, 'mean_word_length': 1.4631782945736433, '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': '3994503', 'n_tokens_mistral': 747, 'n_tokens_neox': 696, 'n_words': 179}