#!/usr/bin/env node
const arg = require('arg');
import { admin } from '../commands/admin';
import { dev } from '../commands/dev';
import { build } from '../commands/build';
const version = require('../../package.json').version;
console.log(`2fn v${version}`);

try {
  const args = arg({
    '--admin': Boolean,
    '--dev': Boolean,
    '--build': Boolean,
  });
  if (args['--admin']) {
    admin();
  } else if (args['--dev']) {
    dev();
  } else if (args['--build']) {
    build();
  }
} catch (e) {
  console.log('Unknown command.', e);
  usage();
}

function usage() {
  console.log(
    `
nope
  `
  );
}
