git ssb

0+

अभिनाश / bisauni



Commit f0ad0856d705f540141a5c19183f99eae95181be

read file and process it

Avinash committed on 12/3/2018, 11:44:07 AM
Parent: 395b3f0b3ea99421ead4e9ae4790da2493d71a6b

Files changed

main.jschanged
timelog.jschanged
main.jsView
@@ -6,6 +6,4 @@
66 mb.on('ready', function ready () {
77 console.log('app is ready')
88 // your app code here
99 })
10-
11-console.log(timeLog)
timelog.jsView
@@ -1,14 +1,40 @@
1-const path = require('path');
1 +const path = require('path')
2 +const os = require('os')
3 +const fs = require('fs')
24
35 class TimeLog {
6 +
47 constructor() {
58 const DS = path.sep
6- const basePath = `~${DS}.local${DS}share${DS}gtimelog${DS}`
9 + const basePath = `${os.homedir()}${DS}.local${DS}share${DS}gtimelog${DS}`
710 this.paths = {
811 log: `${basePath}timelog.txt`,
912 tasks: `${basePath}tasks.txt`
1013 }
14 + this.init()
15 + this.updateLog()
16 + this.processLog()
1117 }
18 +
19 + init() {
20 + this.tasks = []
21 + }
22 +
23 + today() {
24 + }
25 +
26 + updateLog() {
27 + const file = fs.readFileSync(this.paths.log, 'utf-8')
28 + this.log =
29 + file
30 + .split('\n')
31 + .filter((line) => {return line !== ''})
32 + }
33 +
34 + processLog() {
35 + console.log(this.log)
36 + console.log(this.tasks)
37 + }
1238 }
1339
1440 module.exports = new TimeLog()

Built with git-ssb-web