Comparing version 0.6.1-20 to 0.6.2-23
@@ -82,22 +82,2 @@ | ||
// table format for a single app.. we convert into a generic N/V pair table of app properties | ||
function createTableForAppProps(app) { | ||
var pairs = { | ||
Id : app.inst.guid, | ||
Title: app.inst.title, | ||
Description: app.inst.description, | ||
W3C: app.app.w3cid, | ||
Widg: app.app.guid, | ||
Config: JSON.stringify(app.inst.config) | ||
}; | ||
var scm = app.app.config.scm; | ||
if (scm) { | ||
if (scm.url) pairs["Git Url"] = scm.url; | ||
if (scm.branch) pairs["Git Branch"] = scm.branch; | ||
if (scm.key) pairs["Key"] = scm.key; | ||
} | ||
return common.createNVTable(pairs); | ||
}; | ||
// read an app | ||
@@ -111,3 +91,3 @@ function read (appId, cb) { | ||
if(ini.get('table') === true && data) { | ||
apps.table = createTableForAppProps(data); | ||
apps.table = common.createTableForAppProps(data); | ||
} | ||
@@ -114,0 +94,0 @@ |
@@ -142,2 +142,6 @@ // Misc common functions.. | ||
exports.createTableForTemplates = function (apps) { | ||
return exports.createTableForApps(apps); | ||
}; | ||
// lists all our FeedHenry Apps | ||
@@ -149,17 +153,32 @@ function listApps(cb) { | ||
function listTemplates(cb) { | ||
var payload = {}; | ||
exports.doApiCall(fhreq.getFeedHenryUrl(), "box/srv/1.1/ide/" + fhc.domain + "/app/templatelist", payload, "Error reading template: ", cb); | ||
} | ||
// returns an array of App Ids | ||
function formatIds(err, data, cb) { | ||
if(err) return cb(err); | ||
var ids = []; | ||
if(!err) { | ||
for (var i=0; i<data.list.length; i++){ | ||
var app = data.list[i]; | ||
ids.push(app.id); | ||
} | ||
} | ||
return cb(err, ids); | ||
} | ||
function getAppIds(cb) { | ||
listApps(function(err, data){ | ||
if(err) return cb(err); | ||
var ids = []; | ||
if(!err) { | ||
for (var i=0; i<data.list.length; i++){ | ||
var app = data.list[i]; | ||
ids.push(app.id); | ||
} | ||
} | ||
return cb(err, ids); | ||
listApps(function (err, data) { | ||
formatIds(err, data, cb); | ||
}); | ||
} | ||
function getTemplateIds(cb) { | ||
listTemplates(function (err, data) { | ||
formatIds(err, data, cb); | ||
}); | ||
} | ||
// common read app | ||
@@ -219,9 +238,32 @@ function readApp(appId, cb) { | ||
// table format for a single app.. we convert into a generic N/V pair table of app properties | ||
function createTableForAppProps(app) { | ||
var pairs = { | ||
Id : app.inst.guid, | ||
Title: app.inst.title, | ||
Description: app.inst.description, | ||
W3C: app.app.w3cid, | ||
Widg: app.app.guid, | ||
Config: JSON.stringify(app.inst.config) | ||
}; | ||
var scm = app.app.config.scm; | ||
if (scm) { | ||
if (scm.url) pairs["Git Url"] = scm.url; | ||
if (scm.branch) pairs["Git Branch"] = scm.branch; | ||
if (scm.key) pairs["Key"] = scm.key; | ||
} | ||
return createNVTable(pairs); | ||
}; | ||
exports.createNVTable = createNVTable; | ||
exports.createObjectTable = createObjectTable; | ||
exports.createTableForAppProps = createTableForAppProps; | ||
exports.listApps = listApps; | ||
exports.listTemplates = listTemplates; | ||
exports.readApp = readApp; | ||
exports.getAppIds = getAppIds; | ||
exports.getTemplateIds = getTemplateIds; | ||
exports.strlen = strlen; | ||
exports.maxTableCell = 100; | ||
@@ -107,3 +107,3 @@ module.exports = df; | ||
// calculate widths | ||
var maxApp=4, maxUser = 5, maxInstance=8, maxPort=5, maxState=5, maxUrl = 3; | ||
var maxTitle=5, maxName=4, maxUser=5, maxPort=5, maxState=5, maxUrl=3; | ||
@@ -113,6 +113,6 @@ for (var a in apps) { | ||
if(common.strlen(app.title) > maxApp) maxApp = common.strlen(app.title); | ||
if(common.strlen(app.title) > maxTitle) maxTitle = common.strlen(app.title); | ||
if(common.strlen(app.appname) > maxName) maxName = common.strlen(app.appname); | ||
if(common.strlen(app.url) > maxUrl) maxUrl = common.strlen(app.url); | ||
if(common.strlen(app.email) > maxUser) maxUser = common.strlen(app.email); | ||
if(common.strlen(app.instance) > maxInstance) maxInstance = common.strlen(app.instance); | ||
if(common.strlen(app.port) > maxPort) maxPort = common.strlen(app.port); | ||
@@ -124,4 +124,4 @@ if(common.strlen(app.state) > maxState) maxState = common.strlen(app.state); | ||
df.table = new Table({ | ||
head: ['App', 'Url', 'Email', 'Instance', 'Port', 'State'], | ||
colWidths: [maxApp+2 , maxUrl+2, maxUser+2, maxInstance+2, maxPort+2, maxState+2], | ||
head: ['Title', 'Name', 'Url', 'Email', 'Port', 'State'], | ||
colWidths: [maxTitle+2 , maxName+2, maxUrl+2, maxUser+2, maxPort+2, maxState+2], | ||
style: common.style() | ||
@@ -133,3 +133,3 @@ }); | ||
var app = apps[a]; | ||
df.table.push([app.title, app.url, app.email, app.instance, app.port || '-', app.state]); | ||
df.table.push([app.title, app.appname, app.url, app.email, app.port || '-', app.state]); | ||
} | ||
@@ -180,2 +180,3 @@ } | ||
} catch (x) { | ||
log.error("Error parsing: " + body); | ||
return cb(x); | ||
@@ -182,0 +183,0 @@ } |
@@ -63,3 +63,3 @@ | ||
// | ||
, cmdList = [ | ||
, cmdList = fhc.cmdList = [ | ||
,'act' | ||
@@ -69,8 +69,5 @@ ,'apps' | ||
,'ota' | ||
,'fhcfg' | ||
,'completion' | ||
,'configuration' | ||
,'files' | ||
,'git' | ||
,'help' | ||
,'import' | ||
@@ -81,4 +78,4 @@ ,'logs' | ||
,'search' | ||
,'set' | ||
,'stage' | ||
,'templates' | ||
,'target' | ||
@@ -90,2 +87,8 @@ ,'targets' | ||
] | ||
, fhcList = fhc.fhcList = [ | ||
,'fhcfg' | ||
,'completion' | ||
,'help' | ||
,'set' | ||
] | ||
, plumbing = [ | ||
@@ -98,3 +101,3 @@ // internal commands/work in progress | ||
] | ||
, fullList = fhc.fullList = cmdList.concat(aliasNames).filter(function (c) { | ||
, fullList = fhc.fullList = cmdList.concat(aliasNames).concat(fhcList).filter(function (c) { | ||
return plumbing.indexOf(c) === -1; | ||
@@ -104,2 +107,3 @@ }) | ||
Object.keys(abbrevs).concat(plumbing).forEach(function (c) { | ||
@@ -111,5 +115,2 @@ Object.defineProperty(fhc.commands, c, { get : function () { | ||
var a = fhc.deref(c); | ||
if (c === "la" || c === "ll") { | ||
fhc.config.set("long", true); | ||
} | ||
if (commandCache[a]) return commandCache[a]; | ||
@@ -116,0 +117,0 @@ return commandCache[a] = require(__dirname+"/"+a); |
module.exports = help; | ||
var fs = require("fs") | ||
, path = require("path") | ||
, exec = require("./utils/exec") | ||
, fhc = require("./fhc") | ||
, output = require("./utils/output"); | ||
var fs = require("fs"); | ||
var path = require("path"); | ||
var exec = require("./utils/exec"); | ||
var fhc = require("./fhc"); | ||
var output = require("./utils/output"); | ||
var util = require("util"); | ||
@@ -54,6 +55,7 @@ function help (args, cb) { | ||
, "where <command> is one of: " | ||
, " " + wrap(Object.keys(fhc.commands)) | ||
, " " + wrap(fhc.cmdList) | ||
, "\nor an internal FHC commands: " | ||
, " " + wrap(fhc.fhcList) | ||
, "\nAdd -h to any command for quick help, or for man pages, use fhc help <command>." | ||
, "" | ||
, "Add -h to any command for quick help, or for man pages, use fhc help <command>." | ||
, "" | ||
].join("\n"), function () { cb(er); }); | ||
@@ -83,9 +85,10 @@ }); | ||
var sectionList = files.concat("help.1") | ||
.filter(function (s) { return s.match(/\.1$/); }) | ||
.map(function (s) { return s.replace(/\.1$/, '');}) | ||
.filter(function(s) { if(ignoreSections.indexOf(s) == -1) return s; }); | ||
// .filter(function(s) { console.log(ignoreSections.indexOf(s)); console.log(s); return s;}) | ||
.filter(function (s) {return s.match(/\.1$/); }) | ||
.map(function (s) { return s.replace(/\.1$/, '');}); | ||
//.filter(function(s) { console.log("3: " + s + " -> " + ignoreSections.indexOf(s)); if(ignoreSections.indexOf(s) == -1) return s; }); | ||
cb(undefined, sectionList); | ||
}); | ||
} | ||
@@ -5,3 +5,3 @@ { | ||
"keywords" : [ "cli", "feedhenry" ], | ||
"version": "0.6.1-20", | ||
"version": "0.6.2-23", | ||
"preferGlobal" : true, | ||
@@ -8,0 +8,0 @@ "homepage" : "http://git.io/fh-fhc", |
@@ -1,1 +0,1 @@ | ||
0.6.1-20 | ||
0.6.2-23 |
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
85
5295
219590
67
14