-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.js
50 lines (37 loc) · 1.02 KB
/
commands.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
var fs = require('fs');
module.exports = {
pwd: function(){
process.stdout.write(process.execPath)
},
date: function(input){
process.stdout.write(Date());
},
ls: function(input){
fs.readdir('.', function(err, files) { /// please come back
if (err) throw err;
files.forEach(function(file) {
process.stdout.write(file.toString() + "\n");
})
process.stdout.write("3prompt > ");
});
},
cat: function(input){
console.log(input);
console.log(input);fs.readFile(input, (err, data) => {
if (err) throw err;
console.log(data);
});
},
head: function(input){
fs.readFile(input, (err, data) => {
if (err) throw err;
console.log(data);
});
},
tail: function(input){
fs.readFile(input, (err, data) => {
if (err) throw err;
console.log(data);
});
}
}