{"action":"created","comment":{"url":"https://api.github.com/repos/HackYourFuture/Node.js/pulls/comments/165822415","pull_request_review_id":93824342,"id":165822415,"diff_hunk":"@@ -0,0 +1,135 @@\n+\n+const fs = require('fs');\n+const readline = require('readline');\n+let todos = [];\n+\n+\n+if (process.argv[2] !== undefined) {\n+    start();\n+} else {\n+    console.log('Please specify an option to use, here is the manual\\n');\n+    manualReader('./help.txt');\n+}\n+\n+\n+function start() {\n+    switch (process.argv[2].trim().toLowerCase()) {\n+        case 'help':\n+            manualReader('./help.txt');\n+            break;\n+        case 'add':\n+            checkFileContent().then((item) => addTodoItem(item)).catch((err) => console.log(err));\n+            break;\n+        case 'remove':\n+            itemRemover(process.argv[3]);\n+            break;\n+        case 'list':\n+            console.log('The items on your todo list: ');\n+            todoFileReader('./todos.txt');\n+            break;\n+        case 'reset':\n+            itemsResetter();\n+            break;\n+        default:\n+            console.log('No such option! Take a look at the manual\\n');\n+            manualReader('./help.txt');\n+            break;\n+    }\n+}\n+\n+\n+function manualReader(fileName) {\n+    fs.readFile(fileName, 'UTF-8', (err, data) => {\n+        console.log(data);\n+    });\n+}\n+\n+//  display the todo file once called\n+function todoFileReader(fileName) {\n+    fs.exists(fileName, (exists) => {\n+        //see if file exists to add the existing items to the array\n+        if (exists) {\n+            fs.readFile(fileName, 'UTF-8', (err, data) => {\n+                if (data === \"\") {\n+                    console.log('There are no items yet, try using \\'node index.js add \"some todo item\"\\'');\n+                    return;\n+                }\n+                data = data.split('\\r\\n');\n+                let text = data.reduce(((last, item, index) => last += `${index + 1}. ${item}\\n`), ``);\n+                console.log(text);\n+            });\n+        } else {\n+            console.log('There are no items yet, try using \\'node index.js add \"some todo item\"\\'');\n+        }\n+    });\n+}\n+\n+\n+\n+//check if there's already a file and to push the item in\n+\n+function checkFileContent() {\n+    return new Promise(function (resolve, reject) {\n+        fs.exists('./todos.txt', (exists) => {\n+            if (!exists) {\n+                resolve(process.argv[3]);\n+                return;","path":"week2/index.js","position":76,"original_position":76,"commit_id":"d16451c9077fb34253e9ab8b14f3c40f2632e54a","original_commit_id":"d16451c9077fb34253e9ab8b14f3c40f2632e54a","user":{"login":"jasongwartz","id":10981911,"avatar_url":"https://avatars1.githubusercontent.com/u/10981911?v=4","gravatar_id":"","url":"https://api.github.com/users/jasongwartz","html_url":"https://github.com/jasongwartz","followers_url":"https://api.github.com/users/jasongwartz/followers","following_url":"https://api.github.com/users/jasongwartz/following{/other_user}","gists_url":"https://api.github.com/users/jasongwartz/gists{/gist_id}","starred_url":"https://api.github.com/users/jasongwartz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jasongwartz/subscriptions","organizations_url":"https://api.github.com/users/jasongwartz/orgs","repos_url":"https://api.github.com/users/jasongwartz/repos","events_url":"https://api.github.com/users/jasongwartz/events{/privacy}","received_events_url":"https://api.github.com/users/jasongwartz/received_events","type":"User","site_admin":false},"body":"you don't need to 'return' inside a Promise, you just 'resolve' and that's the end.","created_at":"2018-02-03T19:01:07Z","updated_at":"2018-02-03T19:12:12Z","html_url":"https://github.com/HackYourFuture/Node.js/pull/81#discussion_r165822415","pull_request_url":"https://api.github.com/repos/HackYourFuture/Node.js/pulls/81","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/HackYourFuture/Node.js/pulls/comments/165822415"},"html":{"href":"https://github.com/HackYourFuture/Node.js/pull/81#discussion_r165822415"},"pull_request":{"href":"https://api.github.com/repos/HackYourFuture/Node.js/pulls/81"}}},"pull_request":{"url":"https://api.github.com/repos/HackYourFuture/Node.js/pulls/81","id":163798426,"html_url":"https://github.com/HackYourFuture/Node.js/pull/81","diff_url":"https://github.com/HackYourFuture/Node.js/pull/81.diff","patch_url":"https://github.com/HackYourFuture/Node.js/pull/81.patch","issue_url":"https://api.github.com/repos/HackYourFuture/Node.js/issues/81","number":81,"state":"open","locked":false,"title":"the assigment is already uploaded","user":{"login":"moesi88","id":30569071,"avatar_url":"https://avatars1.githubusercontent.com/u/30569071?v=4","gravatar_id":"","url":"https://api.github.com/users/moesi88","html_url":"https://github.com/moesi88","followers_url":"https://api.github.com/users/moesi88/followers","following_url":"https://api.github.com/users/moesi88/following{/other_user}","gists_url":"https://api.github.com/users/moesi88/gists{/gist_id}","starred_url":"https://api.github.com/users/moesi88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moesi88/subscriptions","organizations_url":"https://api.github.com/users/moesi88/orgs","repos_url":"https://api.github.com/users/moesi88/repos","events_url":"https://api.github.com/users/moesi88/events{/privacy}","received_events_url":"https://api.github.com/users/moesi88/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-01-18T19:18:09Z","updated_at":"2018-02-03T19:12:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d6fccfe8a6d40f3f00d6ff4e8a47c43682d9fcf7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/HackYourFuture/Node.js/pulls/81/commits","review_comments_url":"https://api.github.com/repos/HackYourFuture/Node.js/pulls/81/comments","review_comment_url":"https://api.github.com/repos/HackYourFuture/Node.js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HackYourFuture/Node.js/issues/81/comments","statuses_url":"https://api.github.com/repos/HackYourFuture/Node.js/statuses/d16451c9077fb34253e9ab8b14f3c40f2632e54a","head":{"label":"moesi88:master","ref":"master","sha":"d16451c9077fb34253e9ab8b14f3c40f2632e54a","user":{"login":"moesi88","id":30569071,"avatar_url":"https://avatars1.githubusercontent.com/u/30569071?v=4","gravatar_id":"","url":"https://api.github.com/users/moesi88","html_url":"https://github.com/moesi88","followers_url":"https://api.github.com/users/moesi88/followers","following_url":"https://api.github.com/users/moesi88/following{/other_user}","gists_url":"https://api.github.com/users/moesi88/gists{/gist_id}","starred_url":"https://api.github.com/users/moesi88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moesi88/subscriptions","organizations_url":"https://api.github.com/users/moesi88/orgs","repos_url":"https://api.github.com/users/moesi88/repos","events_url":"https://api.github.com/users/moesi88/events{/privacy}","received_events_url":"https://api.github.com/users/moesi88/received_events","type":"User","site_admin":false},"repo":{"id":118025313,"name":"Node.js","full_name":"moesi88/Node.js","owner":{"login":"moesi88","id":30569071,"avatar_url":"https://avatars1.githubusercontent.com/u/30569071?v=4","gravatar_id":"","url":"https://api.github.com/users/moesi88","html_url":"https://github.com/moesi88","followers_url":"https://api.github.com/users/moesi88/followers","following_url":"https://api.github.com/users/moesi88/following{/other_user}","gists_url":"https://api.github.com/users/moesi88/gists{/gist_id}","starred_url":"https://api.github.com/users/moesi88/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moesi88/subscriptions","organizations_url":"https://api.github.com/users/moesi88/orgs","repos_url":"https://api.github.com/users/moesi88/repos","events_url":"https://api.github.com/users/moesi88/events{/privacy}","received_events_url":"https://api.github.com/users/moesi88/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/moesi88/Node.js","description":"NodeJS 101 course","fork":true,"url":"https://api.github.com/repos/moesi88/Node.js","forks_url":"https://api.github.com/repos/moesi88/Node.js/forks","keys_url":"https://api.github.com/repos/moesi88/Node.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/moesi88/Node.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/moesi88/Node.js/teams","hooks_url":"https://api.github.com/repos/moesi88/Node.js/hooks","issue_events_url":"https://api.github.com/repos/moesi88/Node.js/issues/events{/number}","events_url":"https://api.github.com/repos/moesi88/Node.js/events","assignees_url":"https://api.github.com/repos/moesi88/Node.js/assignees{/user}","branches_url":"https://api.github.com/repos/moesi88/Node.js/branches{/branch}","tags_url":"https://api.github.com/repos/moesi88/Node.js/tags","blobs_url":"https://api.github.com/repos/moesi88/Node.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/moesi88/Node.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/moesi88/Node.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/moesi88/Node.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/moesi88/Node.js/statuses/{sha}","languages_url":"https://api.github.com/repos/moesi88/Node.js/languages","stargazers_url":"https://api.github.com/repos/moesi88/Node.js/stargazers","contributors_url":"https://api.github.com/repos/moesi88/Node.js/contributors","subscribers_url":"https://api.github.com/repos/moesi88/Node.js/subscribers","subscription_url":"https://api.github.com/repos/moesi88/Node.js/subscription","commits_url":"https://api.github.com/repos/moesi88/Node.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/moesi88/Node.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/moesi88/Node.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/moesi88/Node.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/moesi88/Node.js/contents/{+path}","compare_url":"https://api.github.com/repos/moesi88/Node.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/moesi88/Node.js/merges","archive_url":"https://api.github.com/repos/moesi88/Node.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/moesi88/Node.js/downloads","issues_url":"https://api.github.com/repos/moesi88/Node.js/issues{/number}","pulls_url":"https://api.github.com/repos/moesi88/Node.js/pulls{/number}","milestones_url":"https://api.github.com/repos/moesi88/Node.js/milestones{/number}","notifications_url":"https://api.github.com/repos/moesi88/Node.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/moesi88/Node.js/labels{/name}","releases_url":"https://api.github.com/repos/moesi88/Node.js/releases{/id}","deployments_url":"https://api.github.com/repos/moesi88/Node.js/deployments","created_at":"2018-01-18T19:03:35Z","updated_at":"2018-01-18T19:03:38Z","pushed_at":"2018-01-28T14:36:19Z","git_url":"git://github.com/moesi88/Node.js.git","ssh_url":"git@github.com:moesi88/Node.js.git","clone_url":"https://github.com/moesi88/Node.js.git","svn_url":"https://github.com/moesi88/Node.js","homepage":null,"size":598,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"HackYourFuture:master","ref":"master","sha":"7f995741be3af809612e275c30c78421ec498f44","user":{"login":"HackYourFuture","id":20858568,"avatar_url":"https://avatars2.githubusercontent.com/u/20858568?v=4","gravatar_id":"","url":"https://api.github.com/users/HackYourFuture","html_url":"https://github.com/HackYourFuture","followers_url":"https://api.github.com/users/HackYourFuture/followers","following_url":"https://api.github.com/users/HackYourFuture/following{/other_user}","gists_url":"https://api.github.com/users/HackYourFuture/gists{/gist_id}","starred_url":"https://api.github.com/users/HackYourFuture/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HackYourFuture/subscriptions","organizations_url":"https://api.github.com/users/HackYourFuture/orgs","repos_url":"https://api.github.com/users/HackYourFuture/repos","events_url":"https://api.github.com/users/HackYourFuture/events{/privacy}","received_events_url":"https://api.github.com/users/HackYourFuture/received_events","type":"Organization","site_admin":false},"repo":{"id":68906713,"name":"Node.js","full_name":"HackYourFuture/Node.js","owner":{"login":"HackYourFuture","id":20858568,"avatar_url":"https://avatars2.githubusercontent.com/u/20858568?v=4","gravatar_id":"","url":"https://api.github.com/users/HackYourFuture","html_url":"https://github.com/HackYourFuture","followers_url":"https://api.github.com/users/HackYourFuture/followers","following_url":"https://api.github.com/users/HackYourFuture/following{/other_user}","gists_url":"https://api.github.com/users/HackYourFuture/gists{/gist_id}","starred_url":"https://api.github.com/users/HackYourFuture/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HackYourFuture/subscriptions","organizations_url":"https://api.github.com/users/HackYourFuture/orgs","repos_url":"https://api.github.com/users/HackYourFuture/repos","events_url":"https://api.github.com/users/HackYourFuture/events{/privacy}","received_events_url":"https://api.github.com/users/HackYourFuture/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/HackYourFuture/Node.js","description":"NodeJS 101 course","fork":false,"url":"https://api.github.com/repos/HackYourFuture/Node.js","forks_url":"https://api.github.com/repos/HackYourFuture/Node.js/forks","keys_url":"https://api.github.com/repos/HackYourFuture/Node.js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HackYourFuture/Node.js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HackYourFuture/Node.js/teams","hooks_url":"https://api.github.com/repos/HackYourFuture/Node.js/hooks","issue_events_url":"https://api.github.com/repos/HackYourFuture/Node.js/issues/events{/number}","events_url":"https://api.github.com/repos/HackYourFuture/Node.js/events","assignees_url":"https://api.github.com/repos/HackYourFuture/Node.js/assignees{/user}","branches_url":"https://api.github.com/repos/HackYourFuture/Node.js/branches{/branch}","tags_url":"https://api.github.com/repos/HackYourFuture/Node.js/tags","blobs_url":"https://api.github.com/repos/HackYourFuture/Node.js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HackYourFuture/Node.js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HackYourFuture/Node.js/git/refs{/sha}","trees_url":"https://api.github.com/repos/HackYourFuture/Node.js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HackYourFuture/Node.js/statuses/{sha}","languages_url":"https://api.github.com/repos/HackYourFuture/Node.js/languages","stargazers_url":"https://api.github.com/repos/HackYourFuture/Node.js/stargazers","contributors_url":"https://api.github.com/repos/HackYourFuture/Node.js/contributors","subscribers_url":"https://api.github.com/repos/HackYourFuture/Node.js/subscribers","subscription_url":"https://api.github.com/repos/HackYourFuture/Node.js/subscription","commits_url":"https://api.github.com/repos/HackYourFuture/Node.js/commits{/sha}","git_commits_url":"https://api.github.com/repos/HackYourFuture/Node.js/git/commits{/sha}","comments_url":"https://api.github.com/repos/HackYourFuture/Node.js/comments{/number}","issue_comment_url":"https://api.github.com/repos/HackYourFuture/Node.js/issues/comments{/number}","contents_url":"https://api.github.com/repos/HackYourFuture/Node.js/contents/{+path}","compare_url":"https://api.github.com/repos/HackYourFuture/Node.js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HackYourFuture/Node.js/merges","archive_url":"https://api.github.com/repos/HackYourFuture/Node.js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HackYourFuture/Node.js/downloads","issues_url":"https://api.github.com/repos/HackYourFuture/Node.js/issues{/number}","pulls_url":"https://api.github.com/repos/HackYourFuture/Node.js/pulls{/number}","milestones_url":"https://api.github.com/repos/HackYourFuture/Node.js/milestones{/number}","notifications_url":"https://api.github.com/repos/HackYourFuture/Node.js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HackYourFuture/Node.js/labels{/name}","releases_url":"https://api.github.com/repos/HackYourFuture/Node.js/releases{/id}","deployments_url":"https://api.github.com/repos/HackYourFuture/Node.js/deployments","created_at":"2016-09-22T09:36:44Z","updated_at":"2018-02-01T17:26:36Z","pushed_at":"2018-02-01T15:23:32Z","git_url":"git://github.com/HackYourFuture/Node.js.git","ssh_url":"git@github.com:HackYourFuture/Node.js.git","clone_url":"https://github.com/HackYourFuture/Node.js.git","svn_url":"https://github.com/HackYourFuture/Node.js","homepage":null,"size":594,"stargazers_count":20,"watchers_count":20,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":75,"mirror_url":null,"archived":false,"open_issues_count":11,"license":null,"forks":75,"open_issues":11,"watchers":20,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HackYourFuture/Node.js/pulls/81"},"html":{"href":"https://github.com/HackYourFuture/Node.js/pull/81"},"issue":{"href":"https://api.github.com/repos/HackYourFuture/Node.js/issues/81"},"comments":{"href":"https://api.github.com/repos/HackYourFuture/Node.js/issues/81/comments"},"review_comments":{"href":"https://api.github.com/repos/HackYourFuture/Node.js/pulls/81/comments"},"review_comment":{"href":"https://api.github.com/repos/HackYourFuture/Node.js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HackYourFuture/Node.js/pulls/81/commits"},"statuses":{"href":"https://api.github.com/repos/HackYourFuture/Node.js/statuses/d16451c9077fb34253e9ab8b14f3c40f2632e54a"}},"author_association":"NONE"}}
{"actor":{"display_login":"jasongwartz"}}