-
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 c2c916d
Showing
8 changed files
with
576 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,3 @@ | ||
|
||
|
||
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,3 @@ | ||
## Application of things to do, with commands. | ||
|
||
execute: 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,39 @@ | ||
// const argv = require('yargs').argv; | ||
|
||
const argv = require('./config/yargs').argv; | ||
const porHacer = require('./to-do/to-do'); | ||
const colors = require('colors'); | ||
let comando = argv._[0]; | ||
|
||
switch (comando) { | ||
case 'crear': | ||
let tarea = porHacer.crear(argv.descripcion); | ||
console.log(tarea); | ||
console.log('Se creo una tarea.'); | ||
break; | ||
|
||
case 'listar': | ||
console.log('Listado de tareas por hacer.'); | ||
let listado = porHacer.getListado(); | ||
for (let tarea of listado) { | ||
console.log('=====Por hacer======'.green); | ||
console.log(tarea.descripcion); | ||
console.log('Estado: ', tarea.completado); | ||
console.log('===================='.green); | ||
} | ||
break; | ||
|
||
case 'actualizar': | ||
console.log('Tarea actualizada.'); | ||
let actualizado = porHacer.actualizar(argv.descripcion, argv.completado); | ||
console.log(actualizado); | ||
break; | ||
|
||
case 'borrar': | ||
let borrado = porHacer.borrar(argv.descripcion); | ||
console.log(borrado); | ||
break; | ||
|
||
default: | ||
console.log('Comando no reconocido.'); | ||
} |
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 descripcion = { | ||
demand: true, | ||
alias: 'd', | ||
descripcion: 'Descripcion de la tarea por hacer' | ||
} | ||
|
||
const completado = { | ||
default: true, | ||
alias: 'c', | ||
desc: 'Marca como completado o pendiente una tarea' | ||
} | ||
|
||
const argv = require('yargs') | ||
.command('crear', 'Crear un elemento por hacer', { | ||
descripcion | ||
}) | ||
|
||
.command('actualizar', 'Actualiza el estado completado de una tarea', { | ||
descripcion, | ||
completado | ||
}) | ||
|
||
.command('borrar', 'Borra una tarea', { | ||
descripcion | ||
}) | ||
|
||
.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 @@ | ||
[{"descripcion":"Pasear al perro","completado":"true"},{"descripcion":"Hacer las tareas","completado":false}] |
Oops, something went wrong.