4º. 1er cuatrimestre. Itinerario de Sistemas de la Información. Grado en Ingeniería Informática. ULL
Estamos estudiando las extensiones en GitHub Cli:
#! /usr/bin/env node
const ins = require("util").inspect;
const shell = require('shelljs');
const { Command } = require('commander');
const program = new Command();
const { version } = require("./package.json")
program
.version(version)
.option('-r, --repo <repo>', 'repository')
.option('-o, --org <org>', 'org')
.option('-n, --name <name>', 'name');
program.parse(process.argv);
let args = program.args;
debugger;
let originalName = `${program.opts().name}`;
let { org, repo, name } = program.opts();
// console.log(originalName);
if (!org || ! repo || !name) program.help();
if (!shell.which('git')) shell.echo("git not installed")
if (!shell.which('gh')) shell.echo("gh not installed");
let r = shell.exec(`gh api -X PATCH /repos/${org}/${repo} -f name=${name}`, {silent: true});
let rj = JSON.parse(r.stdout)
console.log(`The repo ${org}/${repo} has been renamed to ${rj.full_name}`);
//console.log(`The repo has been renamed to ${rj.full_name}`);
{
"dependencies": {
"comander": "^0.0.1-security",
"commander": "^8.3.0",
"shelljs": "^0.8.4"
},
"name": "gh-repo-rename-alu0101227610",
"description": "",
"version": "1.1.0",
"main": "gh-repo-rename-alu0101227610.js",
"scripts": {
"debug": "node --inspect-brk gh-repo-rename-alu0101227610.js -o ULL-ESIT-DMSI-1920 -r prueba-funciona -n prueba",
"create-prueba": "gh create-repo prueba ULL-ESIT-DMSI-1920",
"list-prueba": "gh submodule-add -s prueba -o ULL-ESIT-DMSI-1920 -n",
"test": "./gh-repo-rename-alu0101227610 -o ULL-ESIT-DMSI-1920 -r prueba -n prueba-funciona; npm run list-prueba",
"back": "./gh-repo-rename-alu0101227610 -o ULL-ESIT-DMSI-1920 -r prueba-funciona -n prueba; npm run list-prueba",
"start": "node gh-repo-rename-alu0101227610.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/alu0101227610/gh-repo-rename-alu0101227610.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/alu0101227610/gh-repo-rename-alu0101227610/issues"
},
"homepage": "https://github.com/alu0101227610/gh-repo-rename-alu0101227610#readme"
}
Node.js 8 the Right Way GitHub. versión de 2013.
Node.js in Action, Second Edition by: Bradley Meck Alex Young and Mike Cantelon. Acceda por medio del PuntoQ de la ULL