-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4689e88
Showing
8 changed files
with
516 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## Console To-Do App | ||
|
||
This is a exercise of node course | ||
|
||
Remember install node pakages with follow command: | ||
|
||
``` | ||
npm install | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//const argv = require('yargs').argv; | ||
const argv = require('./config/yargs').argv; | ||
|
||
const toDo = require('./to-do/to-do'); | ||
|
||
let command = argv._[0]; | ||
|
||
switch (command) { | ||
case 'create': | ||
let work = toDo.create(argv.d); | ||
console.log(work); | ||
break; | ||
case 'read': | ||
let toDoList = toDo.getList(); | ||
|
||
console.log('====To-Do List===='.green); | ||
for (let work of toDoList) { | ||
console.log(work.description); | ||
console.log('status: ', work.complete); | ||
} | ||
console.log('=================='.green); | ||
break; | ||
case 'update': | ||
let updated = toDo.update(argv.description, argv.complete); | ||
console.log(updated); | ||
break; | ||
case 'delete': | ||
let deleted = toDo.delete(argv.description); | ||
console.log(deleted); | ||
default: | ||
console.log('Command not found'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const description = { | ||
demand: true, | ||
alias: 'd', | ||
desc: 'description of to do work' | ||
} | ||
|
||
const complete = { | ||
alias: 'c', | ||
default: true | ||
} | ||
|
||
const argv = require('yargs') | ||
.command('create', 'create a to do work', { | ||
description | ||
}) | ||
.command('update', 'update status of a to do work', { | ||
description, | ||
complete | ||
}) | ||
.command('delete', 'delete a to do work', { | ||
description | ||
}) | ||
.help() | ||
.argv; | ||
|
||
module.exports = { | ||
argv | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[{"description":"play futbol","complete":"true"},{"description":"learn node","complete":false}] |
Oops, something went wrong.