Permalink
Browse files

now using archy for ps output

  • Loading branch information...
1 parent 6bbe770 commit 94994930b295aeb3141c5d185f271101de458665 @substack committed Mar 9, 2012
Showing with 22 additions and 20 deletions.
  1. +19 −18 bin/ps.js
  2. +3 −2 package.json
View
@@ -1,8 +1,11 @@
#!/usr/bin/env node
-var argv = require('../lib/argv');
-var propagit = require('propagit');
var EventEmitter = require('events').EventEmitter;
+var propagit = require('propagit');
+var archy = require('archy');
+
+var argv = require('../lib/argv');
+
var p = propagit(argv);
p.on('error', function (err) {
console.dir(err);
@@ -14,23 +17,21 @@ function text (hub) {
var em = new EventEmitter;
em.on('data', function (key, procs) {
- console.log('drone#' + key);
-
- var pids = Object.keys(procs);
- pids.forEach(function (pid, ix) {
- var last = ix === pids.length - 1;
- var p = procs[pid];
- console.log(
- (last ? '' : '') + '─┬ '
- + 'pid#' + pid
- );
- console.log([
- '',
- ' ├── status: ' + p.status,
- ' ├── commit: ' + p.repo + '/' + p.commit,
- ' └── command: ' + p.command.join(' '),
- ].join('\n' + (last ? ' ' : '')).slice(1));
+ var s = archy({
+ label : 'drone#' + key,
+ nodes : Object.keys(procs).map(function (id) {
+ var p = procs[id];
+ return {
+ label : 'pid#' + id,
+ nodes : [
+ 'status: ' + p.status,
+ 'commit: ' + p.repo + '/' + p.commit,
+ 'command: ' + p.command.join(' '),
+ ],
+ }
+ }),
});
+ console.log(Object.keys(procs).length ? s : s.replace(/\n$/, ''));
});
em.on('end', function () {
View
@@ -1,7 +1,7 @@
{
"name" : "fleet",
"description" : "command a cluster of processes ",
- "version" : "0.0.4",
+ "version" : "0.0.5",
"repository" : {
"type" : "git",
"url" : "git://github.com/substack/fleet.git"
@@ -35,7 +35,8 @@
"dependencies" : {
"propagit" : "~0.5.3",
"optimist" : "~0.3.1",
- "mkdirp" : "~0.3.0"
+ "mkdirp" : "~0.3.0",
+ "archy" : "~0.0.2"
},
"devDependencies" : {
"tap" : "0.0.x"

0 comments on commit 9499493

Please sign in to comment.