-
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 aca44c2
Showing
9 changed files
with
386 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,3 @@ | ||
{ | ||
"esversion": 6 | ||
} |
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 @@ | ||
## Aplicación 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,35 @@ | ||
// const argv = require('yargs').argv; | ||
const argv = require('./config/yargs').argv; | ||
const porHacer = require('./por-hacer/por-hacer'); | ||
var 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('=====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 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,34 @@ | ||
const opcionesCrear = { | ||
descripcion: { | ||
demand: true, | ||
alias: 'd', | ||
desc: 'Descripción de la tarea por hacer' | ||
} | ||
}; | ||
const opcionesActualizar = { | ||
descripcion: { | ||
demand: true, | ||
alias: 'd', | ||
desc: 'Descripción de la tarea por actualizar' | ||
}, | ||
completado: { | ||
alias: 'c', | ||
default: true, | ||
desc: 'Marca como completado o pendiente la tarea' | ||
} | ||
}; | ||
const opcionesBorrar = { | ||
descripcion: { | ||
demand: true, | ||
alias: 'd', | ||
desc: 'Descripción de la tarea por borrar' | ||
} | ||
}; | ||
const argv = require('yargs') | ||
.command('crear', 'Crear un elemento por hacer', opcionesCrear) | ||
.command('actualizar', 'Actualiza el estrado completado de una tarea', opcionesActualizar) | ||
.command('borrar', 'Borra la tarea pasada como descripcion', opcionesBorrar) | ||
.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":"Pasear al perro","completado":false}] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,15 @@ | ||
{ | ||
"name": "04-por-hacer", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "Adrián Antón", | ||
"license": "ISC", | ||
"dependencies": { | ||
"colors": "^1.4.0", | ||
"yargs": "^15.1.0" | ||
} | ||
} |
Oops, something went wrong.