UNPKG

553 BJavaScriptView Raw
1'use strict';
2
3const tildify = require('tildify');
4const chalk = require('chalk');
5
6function publishConsole(args) {
7 // Display help message if user didn't input any arguments
8 if (!args._.length) {
9 return this.call('help', {_: ['publish']});
10 }
11
12 const self = this;
13
14 return this.post.publish({
15 slug: args._.pop(),
16 layout: args._.length ? args._[0] : this.config.default_layout
17 }, args.r || args.replace).then(post => {
18 self.log.info('Published: %s', chalk.magenta(tildify(post.path)));
19 });
20}
21
22module.exports = publishConsole;