How to use the cli.error function in cli

To help you get started, we’ve selected a few cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / apk-factory-service / node_modules / grunt-contrib-jshint / node_modules / jshint / src / cli / cli.js View on Github external
// Reporter that displays additional JSHint data
		case options["show-non-errors"]:
			options.reporter = "../reporters/non_error.js";
			break;

		// Custom reporter
		case options.reporter !== undefined:
			options.reporter = path.resolve(process.cwd(), options.reporter);
		}

		var reporter;
		if (options.reporter) {
			reporter = loadReporter(options.reporter);

			if (reporter === null) {
				cli.error("Can't load reporter file: " + options.reporter);
				process.exit(1);
			}
		}

		var passed = exports.run({
			args: cli.args,
			config: config,
			reporter: reporter,
			ignores: loadIgnores(),
			extensions: options["extra-ext"],
			verbose: options.verbose
		});

		// Patch as per https://github.com/visionmedia/mocha/issues/333
		// fixes issues with piped output on Windows.
		// Root issue is here https://github.com/joyent/node/issues/3584
github MM56 / mm-packer / index.js View on Github external
function packer(options) {
	if(!options.source) {
		cli.error("No source parameter specified");
		return;
	}
	if(!fs.existsSync(options.source)) {
		cli.error("Source directory \"" + options.source + "\" doesn't exist");
		return;
	}
	if(!options.output) {
		cli.error("No output parameter specified");
		return;
	}
	if(!fs.existsSync(options.output)) {
		cli.error("Output directory \"" + options.output + "\" doesn't exist");
		return;
	}

	const source = addTrailingSlash(options.source);
	const output = addTrailingSlash(options.output);
	const name = options.name || "pack";
	debug = options.debug || false;
	options.mimeTypes = options.mimeTypes || [];
	printDebug("Source: " + source);
	printDebug("Output: " + output);
	printDebug("Name: " + name);

	const files = listFiles(source);
	// printDebug(files);

	pack(files, source, output, name, options.mimeTypes);
github jamesshore / object_playground / node_modules / jshint / src / cli / cli.js View on Github external
function loadConfig(fp) {
	if (!fp) {
		return {};
	}

	if (!shjs.test("-e", fp)) {
		cli.error("Can't find config file: " + fp);
		process.exit(1);
	}

	try {
		return JSON.parse(removeComments(shjs.cat(fp)));
	} catch (err) {
		cli.error("Can't parse config file: " + fp);
		process.exit(1);
	}
}
github senchalabs / AppInspector / node_modules / grunt-contrib-jshint / node_modules / jshint / src / cli.js View on Github external
function collect(fp, files, ignores, ext) {
  if (ignores && isIgnored(fp, ignores)) {
    return;
  }

  if (!shjs.test("-e", fp)) {
    cli.error("Can't open " + fp);
    return;
  }

  if (shjs.test("-d", fp)) {
    shjs.ls(fp).forEach(function (item) {
      var itempath = path.join(fp, item);
      if (shjs.test("-d", itempath) || item.match(ext)) {
        collect(itempath, files, ignores, ext);
      }
    });

    return;
  }

  files.push(fp);
}
github jamesshore / automatopia / node_modules / jshint / src / cli.js View on Github external
function collect(fp, files, ignores, ext) {
  if (ignores && isIgnored(fp, ignores)) {
    return;
  }

  if (!shjs.test("-e", fp)) {
    cli.error("Can't open " + fp);
    return;
  }

  if (shjs.test("-d", fp)) {
    shjs.ls(fp).forEach(function (item) {
      var itempath = path.join(fp, item);
      if (shjs.test("-d", itempath) || item.match(ext)) {
        collect(itempath, files, ignores, ext);
      }
    });

    return;
  }

  files.push(fp);
}
github senchalabs / AppInspector / node_modules / grunt-contrib-jshint / node_modules / jshint / src / cli.js View on Github external
cli.error("Can't find config file: " + fp);
      exports.exit(1);
    }

    try {
      var config = JSON.parse(removeComments(shjs.cat(fp)));
      config.dirname = path.dirname(fp);

      if (config['extends']) {
        _.defaults(config, exports.loadConfig(path.resolve(config.dirname, config['extends'])));
        delete config['extends'];
      }

      return config;
    } catch (err) {
      cli.error("Can't parse config file: " + fp);
      exports.exit(1);
    }
  },
github simontabor / serenity / regenerate.js View on Github external
},function(err,html) {
      if (err) return cli.error(err);
      fs.writeFile('./_site'+path,html,function(err) {
        if (err) cli.error(err);
      });
    });
github flozz / stonejs-tools / src / helpers.js View on Github external
helpers.error = function(message, options) {
    if (options.quiet || options.q) {
        return;
    }
    cli.error(message);
};