| 123456789101112131415161718192021222324252627 |
- 'use strict';
- const abbrev = require('abbrev');
- const store = {
- page: require('./page'),
- post: require('./post'),
- route: require('./route'),
- tag: require('./tag'),
- category: require('./category')
- };
- const alias = abbrev(Object.keys(store));
- function listConsole(args) {
- const type = args._.shift();
- const self = this;
- // Display help message if user didn't input any arguments
- if (!type || !alias[type]) {
- return this.call('help', {_: ['list']});
- }
- return this.load().then(() => store[alias[type]].call(self, args));
- }
- module.exports = listConsole;
|