portapy commands

master
BrOakes 2018-11-21 20:42:39 -05:00
parent a0572460ca
commit 87a12a5a71
5 changed files with 79 additions and 62 deletions

View File

@ -0,0 +1,15 @@
#!/usr/bin/env node
let args = process.argv.slice(2);
if (args[0] == 'help' || args[0] == '?' || args[0] == 'h'){
console.log("heres some help");
} else if(args[0] == "version" || args[0] == "v") {
console.log("version number placeholder");
} else if (args[0] == "py" || args[0] == "pyversion") {
if (args[1]){
console.log(args[1]);
} else {
console.log("version of python");
}
}

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "portapy", "name": "portapy",
"version": "0.0.11", "version": "0.0.13",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -1,6 +1,6 @@
{ {
"name": "portapy", "name": "portapy",
"version": "0.0.11", "version": "0.0.13",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -10,7 +10,8 @@
"clean": "node clean.js" "clean": "node clean.js"
}, },
"bin": { "bin": {
"python": "bin/python.js" "python": "bin/python.js",
"portapy": "index.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -24,7 +25,6 @@
"dependencies": { "dependencies": {
"copy-dir": "^0.4.0", "copy-dir": "^0.4.0",
"minimist": "^1.2.0", "minimist": "^1.2.0",
"python": "0.0.4",
"request": "^2.88.0" "request": "^2.88.0"
}, },
"homepage": "https://github.com/marcus13345/portapy#readme" "homepage": "https://github.com/marcus13345/portapy#readme"

View File

@ -71,7 +71,7 @@ async function download() {
console.log(err); console.log(err);
} }
break; break;
}[] }
} }
} }

View File

@ -3,16 +3,18 @@ module.exports = {
} }
const request = require('request'); const request = require('request');
function versions() // let matches = [];
{
return new Promise(resolve => { let versions = function() {
new Promise(resolve => {
request({ request({
uri: "https://www.python.org/ftp/python/", uri: "https://www.python.org/ftp/python/",
}, function (error, response, body) { }, function (error, response, body) {
const re = /"[0-9]{1,}\.[0-9]{1,}(\.[0-9]{1,})*\/"/g; const re = /"[0-9]{1,}\.[0-9]{1,}(\.[0-9]{1,})*\/"/g;
let matches = body.match(re) matches = body.match(re)
matches = matches.map((value) => { matches = matches.map((value) => {
return value.slice(1,-2) return value.slice(1, -2);
}); });
resolve(matches); resolve(matches);
}); });