git-label-cli
Advanced tools
| 'use strict'; | ||
| Object.defineProperty(exports, "__esModule", { | ||
| value: true | ||
| }); | ||
| exports.getRepo = getRepo; | ||
| var _fs = require('fs'); | ||
| /** | ||
| * Extracts the git repo (name/repo) from the provided path. | ||
| * | ||
| * @name getRepo | ||
| * @function | ||
| * @param {string} path the path to extract the git information from | ||
| * @return {Promise} the extracted repo (name/repo) | ||
| */ | ||
| function getRepo(path) { | ||
| return (/(:)(.+)(\.git)/g.exec((0, _fs.readFileSync)(path, 'utf8'))[2].split('/').filter(function (key, index, xs) { | ||
| return index > xs.length - 3; | ||
| }).join('/') | ||
| ); | ||
| } |
| import {readFileSync} from 'fs'; | ||
| /** | ||
| * Extracts the git repo (name/repo) from the provided path. | ||
| * | ||
| * @name getRepo | ||
| * @function | ||
| * @param {string} path the path to extract the git information from | ||
| * @return {Promise} the extracted repo (name/repo) | ||
| */ | ||
| export function getRepo(path) { | ||
| return (/(:)(.+)(\.git)/g).exec(readFileSync(path, 'utf8'))[2] | ||
| .split('/') | ||
| .filter((key, index, xs) => index > xs.length - 3) | ||
| .join('/'); | ||
| } |
@@ -1,2 +0,2 @@ | ||
| "use strict"; | ||
| 'use strict'; | ||
@@ -8,6 +8,8 @@ Object.defineProperty(exports, "__esModule", { | ||
| var _inquirer = require("inquirer"); | ||
| var _inquirer = require('inquirer'); | ||
| var _inquirer2 = _interopRequireDefault(_inquirer); | ||
| var _repo = require('./repo'); | ||
| function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -43,3 +45,3 @@ | ||
| function promptServer() { | ||
| var questions = [{ type: "input", name: "api", message: "api url", default: "https://api.github.com" }, { type: "input", name: "token", message: "api token" }, { type: "input", name: "repo", message: "repo name [username/repo]" }]; | ||
| var questions = [{ type: "input", name: "api", message: "api url", default: "https://api.github.com" }, { type: "input", name: "repo", message: "repo name [username/repo]", default: (0, _repo.getRepo)('.git/config') }, { type: "input", name: "token", message: "api token" }]; | ||
@@ -46,0 +48,0 @@ return new Promise(function (resolve, reject) { |
+1
-1
| { | ||
| "name": "git-label-cli", | ||
| "description": "CLI utility for git-label", | ||
| "version": "1.1.1", | ||
| "version": "1.2.0", | ||
| "homepage": "https://github.com/jasonbellamy", | ||
@@ -6,0 +6,0 @@ "author": { |
| import inquirer from 'inquirer'; | ||
| import {getRepo} from './repo'; | ||
@@ -37,4 +38,4 @@ | ||
| {type: "input", name: "api", message: "api url", default: "https://api.github.com"}, | ||
| {type: "input", name: "token", message: "api token"}, | ||
| {type: "input", name: "repo", message: "repo name [username/repo]"} | ||
| {type: "input", name: "repo", message: "repo name [username/repo]", default: getRepo('.git/config')}, | ||
| {type: "input", name: "token", message: "api token"} | ||
| ]; | ||
@@ -41,0 +42,0 @@ |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
12467
10.11%16
14.29%235
18.09%3
200%