#!/usr/bin/env node
"use strict";

var imageToAscii = require("../index.cjs");

var source = process.argv[2];
if (!source) {
  process.stderr.write("Usage: image-to-ascii <image-path-or-url>\n");
  process.exit(2);
}

imageToAscii(source, { colored: false }, function (err, converted) {
  if (err) {
    process.stderr.write((err && err.message ? err.message : String(err)) + "\n");
    process.exit(1);
  }
  process.stdout.write(String(converted || "") + "\n");
});
