forked from shahednasser/cross-post
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·27 lines (23 loc) · 1.35 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! /usr/bin/env node
const { program } = require('commander')
const config = require('./src/commands/config')
const run = require('./src/commands/run')
const { allowedPlatforms } = require('./src/utils')
program.usage('[command] [options]')
program
.command('run <url>')
.description('Cross post a blog post')
.option('-t, --title [title]', 'Title for the article')
.option('-p, --platforms [platforms...]', 'Platforms to post articles to. Allowed values are: ' + allowedPlatforms.join(", "))
.option('-s, --selector [selector]', 'The selector to look for in the document in the URL supplied. By default, it will be article')
.option('-pu, --public', 'Publish it publically instead of to drafts by default.')
.option('-i, --ignore-image', 'Ignore uploading image with the article. This helps mitigate errors when uploading images')
.option('-is, --image-selector [imageSelector]', 'By default, article images will be the first image detected in the article. This ' +
'allows you to specify the selector of the image to be used instead.')
.option('-iu, --image-url [imageUrl]', 'URL of image to use for the article\'s main image.')
.action(run)
program
.command('config <platform>')
.description('Add configuration for a platform. Allowed values are: ' + allowedPlatforms.join(", "))
.action(config)
program.parse()