-
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
G1189195
committed
Apr 23, 2019
0 parents
commit f387851
Showing
8 changed files
with
594 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 @@ | ||
## Aplicacion de comandos | ||
|
||
Este es el ejercicio del curso | ||
|
||
Recuerden instalar los paquetes de node | ||
|
||
``` | ||
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('./config/yargs').argv; | ||
const porHacer = require('./por-hacer/por-hacer.js'); | ||
const colors = require('colors'); | ||
|
||
let comando = argv._[0]; | ||
|
||
switch (comando) { | ||
case 'crear': | ||
let tarea = porHacer.crear(argv.descripcion); | ||
console.log(tarea); | ||
break; | ||
case 'listar': | ||
let listado = porHacer.getListado(); | ||
for (let tarea of listado) { | ||
console.log('=======Tarea por hacer========'.green); | ||
console.log(tarea.descripcion); | ||
console.log('Estado: ', tarea.completado); | ||
console.log('==============================='.green); | ||
} | ||
break; | ||
case 'actualizar': | ||
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 es 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,29 @@ | ||
const descripcion = { | ||
descripcion: { | ||
demand: true, | ||
alias: 'd' | ||
} | ||
} | ||
|
||
const opts = { | ||
descripcion: { | ||
demand: true, | ||
alias: 'd' | ||
}, | ||
completado: { | ||
default: true, | ||
alias: 'c' | ||
} | ||
} | ||
|
||
const argv = require('yargs') | ||
.command('crear', 'Crear un elemento por hacer', opts) | ||
.command('actualizar', 'Actualiza un estado de una tarea', opts) | ||
.command('listar', 'Listar tareas por hacer') | ||
.command('borrar', 'Borra la tarea indicada', 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":"salir de la casa","completado":false},{"descripcion":"comer","completado":false},{"descripcion":"pasear al perro","completado":false},{"descripcion":"comprar","completado":false}] |
Oops, something went wrong.