-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
59 lines (51 loc) · 1.39 KB
/
app.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
#!/usr/bin/env node
'use strict'
const fs = require("fs");
const path = require("path");
const colors = require('colors');
const argv = require('yargs').option({
search : {
// demand : true,
alias:['s'],
description: "Search Word",
type: 'string'
},
replace : {
// demand : true,
alias:['rp'],
description: "Replace Word",
type: 'string'
},
appendlast : {
// demand : true,
alias:['al'],
description: "Append Word in Last",
type: 'string'
},
appendfirst : {
// demand : true,
alias:['af'],
description: "Append Word in First",
type: 'string'
}
}).help('help').alias('help','h').argv;
//lib
const replaceWord = require("./lib/replace");
const Append = require("./lib/append.js");
var dir = process.cwd();
var searchWord = argv.s;
var renameWord = argv.rp;
var appendWordFirst = argv.af;
var appendWordLast = argv.al;
if(searchWord && renameWord) {
replaceWord(searchWord,renameWord);
} else if(appendWordFirst && appendWordLast) {
Append.appendBothWord(appendWordFirst,appendWordLast);
} else if(appendWordFirst) {
Append.appendWord(appendWordFirst,"First");
} else if(appendWordLast) {
Append.appendWord(appendWordLast,"Last");
} else {
console.log("No Argument Provided");
console.log("For Argumnet List : remall -h");
}