This repository has been archived by the owner on May 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathartisan.js
76 lines (64 loc) · 1.82 KB
/
artisan.js
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// require maudols
var env = require('dotenv').config();
var mysql = require('mysql');
// db connect
var dbh = mysql.createConnection({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_NAME
});
// get command line agruman
var cmdln = process.argv.slice(2);
// handle command line agrumans
switch (cmdln[0]) {
case 'list':
case 'help':
case '--help':
case '--h':
require('./arts/list');
break;
case 'make:model':
if (cmdln[1] != undefined) {
require('./arts/model').make(cmdln[1]);
} else {
console.log('The model name is empty : | ');
}
break;
case 'make:controller':
if (cmdln[1] != undefined) {
require('./arts/controller').make(cmdln[1]);
} else {
console.log('The controller name is empty : | ');
}
break;
case 'make:controller':
if (cmdln[1] != undefined) {
require('./arts/controller').make(cmdln[1]);
} else {
console.log('The controller name is empty : | ');
}
break;
case 'make:migrate':
if (cmdln[1] != undefined) {
require('./arts/migrate').make(cmdln[1]);
} else {
console.log('The controller name is empty : | ');
}
break;
default:
console.log('undefined command : ( ');
}
// dbh.connect(function(err) {
// if (err) {
// console.error('error connecting: ' + err.stack);
// return;
// }
// dbh.query('SELECT 1', function(error, results, fields) {
// // if (error) throw error;
// console.log(error, results, fields);
// // connected!
// dbh.end();
// });
// console.log('connected as id ' + dbh.threadId);
// });