1 | 'use strict';
|
2 |
|
3 | const tildify = require('tildify');
|
4 | const chalk = require('chalk');
|
5 |
|
6 | function publishConsole(args) {
|
7 |
|
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 |
|
22 | module.exports = publishConsole;
|