some refinements to the inspect command
diff --git a/client/lib/commands/inspect.js b/client/lib/commands/inspect.js
index a6a9b60..ed10cee 100644
--- a/client/lib/commands/inspect.js
+++ b/client/lib/commands/inspect.js
@@ -36,23 +36,30 @@
[attached ? 'blue' : chainAttached ? 'blue' : 'dim'] );
ow.actions.get({ actionName: name })
- .then((details) => {
+ .then(details => {
if (details.exec && details.exec.kind === 'sequence') {
//
// sequence
//
- console.log(details.exec.components
- .map(a => {
- const name = a.substring(a.lastIndexOf('/') + 1);
- return chainColor(name);
- }).join(' => '));
+ console.log('This is an action sequence');
+ console.log('\t' + details.exec.components
+ .map(a => chainColor(a.substring(a.lastIndexOf('/') + 1)))
+ .join(' => '));
} else {
//
// normal action
//
- console.log(property ? details.exec[property]
- : 'This is a ' + details.exec.kind.blue + ' action');
+ if (property !== 'inspect' && property != 'get' && property.indexOf('inspect ') < 0 && property.indexOf('get ') < 0) {
+ console.log(details.exec[property] || details[property]);
+ } else {
+ console.log(`This is a ${details.exec.kind.blue} action`);
+ if (details.exec.code && !details.exec.binary) {
+ console.log('\t' + details.exec.code.replace(/\n/g, "\n\t").green);
+ } else if (details.exec.image) {
+ console.log('\t' + details.exec.image.green);
+ }
+ }
}
ok_(next);
@@ -64,6 +71,12 @@
ow.rules.get({ ruleName: name })
.then(okAfter(rule => console.log('on ' + `${rule.trigger}`.magenta + ' => ' + chainColor(rule.action)), next))
.catch(errorWhile('inspecting entity', next));
+ } else if (err.toString().indexOf('404') >= 0) {
+ console.error(`Error: entity ${name} does not exist`.red);
+ next();
+ } else {
+ console.error(err);
+ next();
}
});
}