#! /usr/bin/env node const program = require('commander'); const { fetchFromMedium, pushToGhost, mediumToGhost, createUser } = require ('./functions'); program .version('1.0.0-dev') .description('pull posts from Medium and add them to a Ghost blog'); program.command('fetch-medium ') .alias('fetch') .description('fetch a Medium post') .action((post_url) => { fetchFromMedium(post_url); }); program.command('push-ghost ') .alias('push') .description('push a downloaded Medium post to Ghost') .action((file) => { pushToGhost(file); }); program.command('medium-to-ghost ') .alias('import') .description('copy a Medium file over to Ghost') .action((mediumUrl) => { pushToGhost(mediumUrl); }); program.command('create-user ') .description('create ghost-import.json to import Medium user to Ghost') .action((username, email) => { createUser(username, email); }); program.parse(process.argv)