"use strict";var _arg = _interopRequireDefault(require("arg"));

var _convert = require("./convert");
var _gui = require("./gui");

var _package = require("../../package.json");function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };}

const bootstrap = async () => {
  const args = (0, _arg.default)({
    '--output': String,
    '--verbose': Boolean,
    '--quiet': Boolean,
    '--version': Boolean,
    '--help': Boolean,

    '-o': '--output',
    '-v': '--version' });


  const usage = () => {
    process.stdout.write('usage actual-code [-o outputfile] [file.md]\n');
    process.exit(1);
  };

  if (args['--version']) {
    process.stdout.write(`${_package.version}\n`);
    return;
  }

  if (args['--help']) {
    usage();
  }

  const reporterOpts = {
    isVerbose: args['--verbose'] };


  if (args._.length === 0) {
    (0, _gui.bootGui)(reporterOpts);
  } else {
    await (0, _convert.convert)(args._[0], reporterOpts, args['--output']);
  }
};

bootstrap();