Skip to content

Commit

Permalink
Merge pull request haraka#13 from arlolra/master
Browse files Browse the repository at this point in the history
display local plugins with -l if -c /path/ is supplied
  • Loading branch information
baudehlo committed May 19, 2011
2 parents 921e7f6 + 607521a commit 9a7432f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions bin/haraka
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ var usage = [
].join('\n');


var listPlugins = function (dir) {
var listPlugins = function (b, dir) {

if (!dir) { dir = "plugins/"; }

var plist = "\n" + dir + "\n",
var plist = dir + "\n",
subdirs = [],
pd = fs.readdirSync(path.join(base, dir));
gl = path.join((b ? b : base), dir),
pd = fs.readdirSync(gl);

pd.forEach(function (p) {
if (~p.search('.js')) {
Expand All @@ -58,7 +59,7 @@ var listPlugins = function (dir) {
});

subdirs.forEach(function (s) {
plist += listPlugins(s);
plist += "\n" + listPlugins(b, s);
});

return plist;
Expand Down Expand Up @@ -196,7 +197,10 @@ if (parsed.version) {
console.log("\033[32;40mHaraka.js\033[0m — Version: " + ver);
}
else if (parsed.list) {
console.log(listPlugins());
console.log("\033[32;40m*global\033[0m\n" + listPlugins());
if (parsed['configs']) {
console.log("\033[32;40m*local\033[0m\n" + listPlugins(parsed['configs']));
}
}
else if (parsed.help) {
if (parsed.help === 'true') {
Expand Down

0 comments on commit 9a7432f

Please sign in to comment.