forked from ionic-team/ionic-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhooks.js
More file actions
46 lines (40 loc) · 1 KB
/
hooks.js
File metadata and controls
46 lines (40 loc) · 1 KB
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
38
39
40
41
42
43
44
45
46
'use strict';
var extend = require('../utils/extend');
var shelljs = require('shelljs');
var IonicAppLib = require('ionic-app-lib');
var log = IonicAppLib.logging.logger;
var Hooks = IonicAppLib.hooks;
shelljs.config.silent = true;
var settings = {
title: 'hooks',
name: 'hooks',
summary: 'Manage your Ionic Cordova hooks',
args: {
'[add|remove|permissions|perm]': 'Add, remove, or modify permissions on the default Ionic Cordova hooks'
},
isProjectTask: true
};
function run(ionic, argv) {
var cmd = argv._[1];
try {
switch (cmd) {
case 'add':
Hooks.add(process.cwd());
break;
case 'remove':
Hooks.remove(process.cwd());
break;
case 'perm':
case 'permissions':
Hooks.setHooksPermission(process.cwd());
break;
default:
log.error('Please supply a command - either add or remove');
}
} catch (ex) {
log.error('There was an error running the hooks command: ', ex.stack);
}
}
module.exports = extend(settings, {
run: run
});