add --action-only support to attach
diff --git a/README.md b/README.md
index 03386d4..353c248 100644
--- a/README.md
+++ b/README.md
@@ -30,3 +30,10 @@
Creating action trampoline
Creating sequence splice seq
```
+
+If you wish to limit the instrumentation to the action, avoiding any containing rules or sequences:
+```
+? (wskdb) attach foo --action-only
+Attaching to foo
+ Creating action trampoline
+```
diff --git a/client/lib/rewriter.js b/client/lib/rewriter.js
index 1303544..1f3ab7b 100644
--- a/client/lib/rewriter.js
+++ b/client/lib/rewriter.js
@@ -55,7 +55,7 @@
var Namer = {
prefix: '___debug___',
name: function name(extra) {
- return Namer.prefix + (extra ? extra + '-' : "") + uuid.v4();
+ return Namer.prefix + (extra ? extra + '-' : '') + uuid.v4();
},
isDebugArtifact: function(name) {
return name.indexOf(Namer.prefix) == 0;
@@ -209,8 +209,8 @@
* Attach to the given entity, allowing for debugging its invocations
*
*/
-exports.attach = function attach(wskprops, next, entity) {
- console.log('Attaching'.blue + ' to ' + entity);
+exports.attach = function attach(wskprops, next, entity, option) {
+ console.log('Attaching'.blue + ' to ' + entity + (option ? ' with option ' + option : ''));
try {
var entityNamespace = wskprops['NAMESPACE'];
@@ -218,6 +218,12 @@
console.log(' Creating action trampoline'.green);
splice(ow, entity, entityNamespace, function afterSplice(names) {
+ if (option === '--action-only' || option === '--ao' || option == '-ao') {
+ //
+ // user asked not to instrument any rules or sequences
+ //
+ return next();
+ }
_list(ow, function onList(entities, ow) {
var counter = entities.length;
function countDown() {