<commit_before>var relativeDate = require('relative-date');
var chalk = require('chalk');
var ui = require('../lib/ui');
var client = require('../');

module.exports = function(remote, id, opts) {
	if (!id) return ui.error('Service name required');
	
	function filter(proc) {
		return !id || proc.id === id;
	};

	var c = client(remote);

	c.get(id, function(err, service) {
		if (err) return ui.error(err);

		var leaf = {};

		if (service.start) leaf.start = service.start;
		if (service.build) leaf.build = service.build;
		if (service.revision) leaf.revision = service.revision;
		if (typeof service.limit === 'number') leaf.limit = service.limit;
		if (service.tags) leaf.tags = service.tags;
		if (service.env) leaf.env = service.env;
		
		c.ps(function(err, docks){
			if (err) return ui.error(err);

			var processes = {};

			docks.forEach(function(dock) {
				dock.list
					.filter(filter)
					.forEach(function(current) {
						var info = {}

						if (current.status) info.status = current.status
						if (current.started) info.started = relativeDate(current.started);
						if (current.deployed) info.deployed = relativeDate(current.deployed);
						if (current.revision) info.revision = current.revision
						info.cwd = current.cwd
						if (current.command) info.command = current.command.join(' ')
						info.env = current.env
						info.pid = current.pid

						processes[dock.id] = info
					})
				;
			})

			leaf.ps = processes;
			
			ui.tree({
				label: service.id,
				leaf: leaf
			});
		});
	});
};<commit_msg>change the output styling of #28<commit_after>var relativeDate = require('relative-date');
var chalk = require('chalk');
var ui = require('../lib/ui');
var client = require('../');

module.exports = function(remote, id, opts) {
	if (!id) return ui.error('Service name required');
	
	function filter(proc) {
		return !id || proc.id === id;
	};

	var c = client(remote);

	c.get(id, function(err, service) {
		if (err) return ui.error(err);

		var leaf = {};

		if (service.start) leaf.start = service.start;
		if (service.build) leaf.build = service.build;
		if (service.revision) leaf.revision = service.revision;
		if (typeof service.limit === 'number') leaf.limit = service.limit;
		if (service.tags) leaf.tags = service.tags;
		if (service.env) leaf.env = service.env;
		
		c.ps(function(err, docks){
			if (err) return ui.error(err);

			var processes = {};

			docks.forEach(function(dock) {
				dock.list
					.filter(filter)
					.forEach(function(current) {
						var info = {}

						if (current.status) info.status = current.status
						if (current.started) info.started = relativeDate(current.started);
						if (current.deployed) info.deployed = relativeDate(current.deployed);
						if (current.revision) info.revision = current.revision
						info.cwd = current.cwd
						if (current.command) info.command = current.command.join(' ')
						info.env = current.env
						info.pid = current.pid

						processes[dock.id] = info
					})
				;
			})
			
			var nodes = Object.keys(processes).sort().map(function(id) {
				return {
					label: id,
					leaf: processes[id]
				};
			});

			nodes.unshift({
				leaf: leaf
			});

			ui.tree({
				label: service.id,
				nodes: nodes
			});
		});
	});
};
{'fraction_non_alphanumeric': 0.1592376268060252, 'fraction_numerical': 0.0006148170919151552, 'mean_word_length': 2.9828641370869033, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3777451', 'n_tokens_mistral': 1327, 'n_tokens_neox': 1058, 'n_words': 244}