getDatos () { let objAlumno = {} // Matricula console.log(`${colors.grey.bold('Matricula: ')} ${this.estatus === 'Editar' ? colors.white.bold(this.matricula) : ''}`) objAlumno.matricula = read.question() this.matricula = objAlumno.matricula !== '' ? objAlumno.matricula : this.matricula // Curp console.log(`${colors.grey.bold('Curp: ')} ${this.estatus === 'Editar' ? colors.white.bold(this.curp) : ''}`) objAlumno.curp = read.question() this.curp = objAlumno.curp !== '' ? objAlumno.curp : this.curp // Nombre console.log(`${colors.grey.bold('Nombre(s)')} ${this.estatus === 'Editar' ? colors.white.bold(this.nombre) : ''}`) objAlumno.nombre = read.question() this.nombre = objAlumno.nombre !== '' ? objAlumno.nombre : this.nombre // ApellidoPaterno console.log(`${colors.grey.bold('Apellido Paterno')} ${this.estatus === 'Editar' ? colors.white.bold(this.apellidoPaterno) : ''}`) objAlumno.apellidoPaterno = read.question() this.apellidoPaterno = objAlumno.apellidoPaterno !== '' ? objAlumno.apellidoPaterno : this.apellidoPaterno // ApellidoMaterno console.log(`${colors.grey.bold('Apellido Materno')} ${this.estatus === 'Editar' ? colors.white.bold(this.apellidoMaterno) : ''}`) objAlumno.apellidoMaterno = read.question() this.apellidoMaterno = objAlumno.apellidoMaterno !== '' ? objAlumno.apellidoMaterno : this.apellidoMaterno // Genero console.log(`${colors.grey.bold('Genero')} ${this.estatus === 'Editar' ? colors.white.bold(this.genero) : ''}`) objAlumno.genero = read.question() this.genero = objAlumno.genero !== '' ? objAlumno.genero : this.genero // FechaNacimiento console.log(`${colors.grey.bold('Fecha De Nacimiento: ')} ${this.estatus === 'Editar' ? colors.white.bold(this.fechaNacimiento) : ''}`) objAlumno.fechaNacimiento = read.question() this.fechaNacimiento = objAlumno.fechaNacimiento !== '' ? objAlumno.fechaNacimiento : this.fechaNacimiento }
sh.exec(this.cmds.join(' && '), (code) => { if (code > 0) { console.log(colors.white.bgRed('An error occured')) } else { console.log(colors.white.bgGreen('Done.')) } })
/** * Shared menu functions */ // Write header function writeHeader(title) { var environment = getEnvironment(); cs.clearScreen(); cs.write( frontstartConfig.project.name.gray + ' ' + frontstartConfig.project.version.gray + ' ' + frontstartConfig.project.stage.gray + ' ' + environment.green + ' environment'.green + '\n\n' + colors.white.bgGreen(' ') + '\n' + colors.white.bgGreen(' Fs ') + ' ' + title + '\n' + colors.white.bgGreen(' ') + '\n' ); }
constructor (path) { this.path = path this.hooks = new GitHooks() try { fs.accessSync(`${this.path}/config`, fs.F_OK) } catch (e) { console.error(colors.white.bgRed(`Can't access the git config at ${this.path}/config`)) process.exit(1) } }
var writeUnusedLibs = function (options) { if (options.listUnused) { log(options, colors.white.bold("Unused libraries:")); var unusedLibs = _.clone(registry); _.forEach(bldOrder, function (buildEntry) { if (unusedLibs.hasOwnProperty(buildEntry.name)) { delete unusedLibs[buildEntry.name] } }); write(options, unusedLibs); } };
getCommitMsg () { const commitMsgFile = `${this.path}/COMMIT_EDITMSG` let msg = null try { msg = fs.readFileSync(commitMsgFile) } catch (err) { console.error(colors.white.bgRed(err)) process.exit(1) } return typeof msg.toString === 'function' && msg.toString().split('\n').shift() }
getStagedFiles (pattern) { let against = 'HEAD' sh.cd(process.cwd()) if (sh.exec('git rev-parse --verify HEAD', { silent: true }).code > 0) { // Initial commit: diff against an empty tree object against = '4b825dc642cb6eb9a060e54bf8d69288fbee4904' } // this is the magic: // retrieve all files in staging area that are added, modified or renamed // but no deletions etc let files = sh.exec(`git diff-index --name-only --cached --diff-filter=ACMR ${against} --`, { silent: true }).stdout.trim().split('\n') if (!files.length) { console.error(colors.white.bgRed('No files added to stage. Use git add.')) process.exit(1) } // Copy contents of staged version of files to temporary staging area // because we only want the staged version that will be commited and not // the version in the working directory this.clearTempStaging() let stagedFiles = [] files.forEach((file) => { let id = sh.exec(`git diff-index --cached ${against} ${file} | cut -d " " -f4`, { silent: true }).stdout.trim() let directory = file.replace(/[^\/]+?$/, '') // create staged version of file in temporary staging area with the same // path as the original file so that the phpcs ignore filters can be applied if (typeof pattern === 'undefined' || pattern.test(file)) { stagedFiles.push(`${STAGING_DIR}/${file}`) sh.exec(`mkdir -p "${STAGING_DIR}/${directory}"`) sh.exec(`git cat-file blob ${id} > "${STAGING_DIR}/${file}"`) } }) return stagedFiles }
'use strict' const colors = require('colors') const read = require('readline-sync') const menu = ['Alta de Alumno', 'Consulta', 'Editar', 'Eliminar '] const Alumno = require('./alumno') console.log(`${colors.white.bold('================')}`) console.log(`${colors.white.bold('MENU DE OPCIONES')}`) console.log(`${colors.white.bold('================')}`) let opcion = 1 let alumno = new Alumno() while (menu[opcion] !== undefined) { opcion = read.keyInSelect(menu, `${colors.yellow.bold('Elige una opcion del menu?')}`) switch (menu[opcion]) { case 'Alta de Alumno': alumno.estatus = 'Altas' alumno.getDatos() alumno.agregar() break case 'Consulta': alumno.consultar() console.log(`${alumno.getNombreCompleto()}`) console.log(`${alumno.getEdad()}`) break case 'Editar ' : alumno.editar() break case 'Eliminar ': alumno.estatus = 'Eliminar' alumno.Eliminar()
export function dispStep(text) { console.log(colors.white.bold(`\n=> ${text}`)); }
var writeBuildOrder = function (options) { if (options.listBuildOrder) { log(options, colors.white.bold("Delivery build order:")); write(options, bldOrder, "name"); } };
var writeLibRegister = function (options) { if (options.listRegister) { log(options, colors.white.bold("Registered libraries:")); write(options, registry) } };