Skip to content
This repository has been archived by the owner on May 15, 2019. It is now read-only.

Commit

Permalink
Fixes #52
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdobry committed Mar 5, 2017
1 parent 639b86d commit 5ba4943
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions src/cli/commands/config/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ exports.handler = (opts) => {
controller.log(`Config file: ${config.path.green}`);

const table = new Table({
head: ['Key'.cyan, 'Value'.cyan]
head: ['Key'.bold, 'Value'.bold]
});

let value;

for (let key in defaults) {
value = defaults[key];

table.push([key.white, `${value}`.white]);
table.push([key, `${value}`]);
}

controller.log(table.toString());
Expand Down
4 changes: 2 additions & 2 deletions src/cli/commands/config/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ exports.handler = (opts) => {
controller.log(`Config file: ${config.path.green}`);

const table = new Table({
head: ['Key'.cyan, 'Value'.cyan]
head: ['Key'.bold, 'Value'.bold]
});

let value;

for (let key in values) {
value = values[key];

table.push([key.white, `${value}`.white]);
table.push([key, `${value}`]);
}

controller.log(table.toString());
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/config/set.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ exports.handler = (opts) => {
config.set(opts.key, opts.value);
}

controller.log(`${opts.key.cyan} set to: ${JSON.stringify(opts.value).green}`);
controller.log(`${opts.key.bold} set to: ${JSON.stringify(opts.value).green}`);
controller.log('\nYou must restart the emulator for changes to take effect...');
};
16 changes: 8 additions & 8 deletions src/cli/commands/describe.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ exports.handler = (opts) => {
.then(() => controller.describe(opts.functionName))
.then((cloudfunction) => {
const table = new Table({
head: ['Property'.cyan, 'Value'.cyan]
head: ['Property'.bold, 'Value'.bold]
});

let trigger, resource, params;
Expand All @@ -68,21 +68,21 @@ exports.handler = (opts) => {
trigger = 'Unknown';
}

table.push(['Name', cloudfunction.shortName.white]);
table.push(['Name', cloudfunction.shortName]);
if (cloudfunction.entryPoint) {
table.push(['Entry Point', cloudfunction.entryPoint.white]);
table.push(['Entry Point', cloudfunction.entryPoint]);
}
table.push(['Trigger', trigger.white]);
table.push(['Trigger', trigger]);
if (resource) {
table.push(['Resource', resource.white]);
table.push(['Resource', resource]);
}
if (params) {
table.push(['Params', params.white]);
table.push(['Params', params]);
}
if (cloudfunction.serviceAccount) {
table.push(['Local path', cloudfunction.serviceAccount.white]);
table.push(['Local path', cloudfunction.serviceAccount]);
}
table.push(['Archive', cloudfunction.sourceArchiveUrl.white]);
table.push(['Archive', cloudfunction.sourceArchiveUrl]);

controller.log(table.toString());
})
Expand Down
8 changes: 4 additions & 4 deletions src/cli/commands/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ exports.handler = (opts) => {
controller.log(`No functions deployed ¯\\_(ツ)_/¯. Run ${'functions deploy --help'.bold} for how to deploy a function.`);
} else {
const table = new Table({
head: ['Name'.cyan, 'Trigger'.cyan, 'Resource'.cyan]
head: ['Name'.bold, 'Trigger'.bold, 'Resource'.bold]
});

cloudfunctions.forEach((cloudfunction) => {
Expand All @@ -82,9 +82,9 @@ exports.handler = (opts) => {
}
if (pathExists(cloudfunction.serviceAccount)) {
table.push([
cloudfunction.shortName.white,
trigger.white,
resource.white
cloudfunction.shortName,
trigger,
resource
]);
} else {
table.push([
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ exports.handler = (opts) => {
.then((status) => {
if (status.state === controller.STATE.RUNNING) {
controller.write(controller.name);
controller.write(' RUNNING\n'.cyan);
controller.write(' RUNNING\n'.green);
return;
}

Expand Down
42 changes: 21 additions & 21 deletions src/cli/commands/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ exports.handler = (opts) => {
return controller.status()
.then((status) => {
const table = new Table({
head: [{ colSpan: 2, content: controller.name.cyan }]
head: [{ colSpan: 2, content: controller.name.bold }]
});
const config = status.metadata;

Expand All @@ -62,34 +62,34 @@ exports.handler = (opts) => {
time = `${Math.floor(time)} seconds`;
}

table.push(['Status'.white, 'RUNNING'.green]);
table.push(['Uptime'.white, time]);
table.push(['Process ID'.white, config.pid]);
table.push(['REST Service'.white, `http://${config.restHost}:${config.restPort}/`]);
table.push(['gRPC Service'.white, `http://${config.grpcHost}:${config.grpcPort}/`]);
table.push(['Status', 'RUNNING'.green]);
table.push(['Uptime', time]);
table.push(['Process ID', config.pid]);
table.push(['REST Service', `http://${config.restHost}:${config.restPort}/`]);
table.push(['gRPC Service', `http://${config.grpcHost}:${config.grpcPort}/`]);
if (config.inspect || config.debug) {
table.push(['Debugger'.white, 'ACTIVE'.green]);
table.push(['Debugger', 'ACTIVE'.green]);
if (config.inspect) {
table.push(['Debugger Port'.white, `${config.inspectPort}`.white]);
table.push(['Debugger Port', `${config.inspectPort}`]);
} else {
table.push(['Debugger Port'.white, `${config.debugPort}`.white]);
table.push(['Debugger Port', `${config.debugPort}`]);
}
} else if (config.debug) {
table.push(['Debugger'.white, 'INACTIVE'.yellow]);
table.push(['Debugger', 'INACTIVE'.yellow]);
}
table.push(['Log file'.white, config.logFile]);
table.push(['Project ID'.white, config.projectId]);
table.push(['Region'.white, config.region]);
table.push(['Storage Mode'.white, config.storage]);
table.push(['Log file', config.logFile]);
table.push(['Project ID', config.projectId]);
table.push(['Region', config.region]);
table.push(['Storage Mode', config.storage]);

if (config.mocks) {
table.push(['Mocks'.white, 'LOADED'.green]);
table.push(['Mocks', 'LOADED'.green]);
} else {
table.push(['Mocks'.white, 'NOT LOADED'.yellow]);
table.push(['Mocks', 'NOT LOADED'.yellow]);
}

table.push([{ colSpan: 2, content: 'Supervisor'.cyan }]);
table.push(['Trigger URL'.white, `http://${config.supervisorHost}:${config.supervisorPort}/${config.projectId}/${config.region}/FUNCTION_NAME`]);
table.push([{ colSpan: 2, content: 'Supervisor'.bold }]);
table.push(['Trigger URL', `http://${config.supervisorHost}:${config.supervisorPort}/${config.projectId}/${config.region}/FUNCTION_NAME`]);
} else {
let time;
if (config.stopped) {
Expand All @@ -103,12 +103,12 @@ exports.handler = (opts) => {
}
}

table.push(['Status'.white, 'STOPPED'.yellow]);
table.push(['Status', 'STOPPED'.yellow]);
if (time) {
table.push(['Last up'.white, `${time.yellow} ${'ago'.white}`]);
table.push(['Last up', `${time.yellow} ${'ago'}`]);
}
if (config.logFile) {
table.push(['Last log file'.white, config.logFile]);
table.push(['Last log file', config.logFile]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ More How-To documentation can be found at:
Something not working? Have a feature request? Open an issue at:
${'https://github.com/GoogleCloudPlatform/cloud-functions-emulator/issues'.bold.underline}.
${'Contributions welcome!'.cyan}`;
${'Contributions welcome!'.green}`;

exports.main = (args) => {
// Load the commands
Expand Down

0 comments on commit 5ba4943

Please sign in to comment.