forked from ionic-team/ionic-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelp.js
More file actions
37 lines (30 loc) · 905 Bytes
/
help.js
File metadata and controls
37 lines (30 loc) · 905 Bytes
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
28
29
30
31
32
33
34
35
36
37
'use strict';
var chalk = require('chalk');
var extend = require('../utils/extend');
var helpUtil = require('../utils/help');
var settings = {
title: 'help',
name: 'help',
summary: 'Provides help for a certain command',
args: {
'[command]': 'The command you desire help with'
},
isProjectTask: false
};
function run(ionic, argv) {
var taskName = argv._[1] ? argv._[1] : '';
// If no task name is provided then print all help available
if (taskName === '') {
var taskList = ionic.getAllTaskSettings();
return helpUtil.printTaskListUsage(taskList, ionic.VERSION);
}
// If a task name is provided and is valid then print Usage
var task = ionic.getTaskSettingsByName(taskName);
if (task) {
return helpUtil.printTaskUsage(task, ionic.VERSION);
}
return console.log(chalk.red.bold('Command not found.'));
}
module.exports = extend(settings, {
run: run
});