add attach-on-launch support
diff --git a/client/lib/repl.js b/client/lib/repl.js
index 6824456..d399199 100644
--- a/client/lib/repl.js
+++ b/client/lib/repl.js
@@ -125,15 +125,16 @@
     '?': help
 };
 
-function repl(wskprops, eventBus) {
-    prompt.prompt([{
-	name: 'command', message: '(wskdb)',
-	prefixMessage: '', // override the default question mark prefix
-	validate: function(line) {
-	    var commandLine = line.split(/\s+/);
-	    return line.length === 0 || commandHandlers[commandLine[0]] ? true : 'Invalid command';
-	}
-    }]).then(function(response) {
+/**
+ * This is the read-eval-print loop.
+ *
+ * @param wskprops is a map that provides the user's NAMESPACE and AUTH settings
+ * @param eventBus will be used to post and listen for inter-function communication
+ * @param attachTo if the user requested to attach to an action on launch
+ *
+ */
+function repl(wskprops, eventBus, attachTo) {
+    function handleReplCommand(response) {
 	if (response.command.length === 0) {
 	    // user hit return;
 	    return repl(wskprops, eventBus);
@@ -182,7 +183,20 @@
 	    // if async, then restart the repl right away
 	    repl(wskprops, eventBus);
 	}
-    });
+    } /* end of handleReplCommand */
+    
+    if (attachTo) {
+	handleReplCommand({ command: 'attach ' + attachTo });
+    } else {
+	prompt.prompt([{
+	    name: 'command', message: '(wskdb)',
+	    prefixMessage: '', // override the default question mark prefix
+	    validate: function(line) {
+		var commandLine = line.split(/\s+/);
+		return line.length === 0 || commandHandlers[commandLine[0]] ? true : 'Invalid command';
+	    }
+	}]).then(handleReplCommand);
+    }
 }
 
 exports.repl = repl;
diff --git a/client/wskdb.js b/client/wskdb.js
index 685339a..bc43579 100644
--- a/client/wskdb.js
+++ b/client/wskdb.js
@@ -70,21 +70,35 @@
     }, 5000);
 
     process.on('exit', function onExit() {
+	try {
+	    console.log('Goodbye!'.red);
+	    clearInterval(keepAlive);
+	    
+	    ws.send(JSON.stringify({
+		type: 'disconnect'
+	    }, function ack() {
+		ws.close();
+	    }));
+	} catch (e) {
+	}
+    });
+
+    //
+    // does the user want to attach to an action right up front?
+    //
+    var attachTo;
     try {
-	console.log('Goodbye!'.red);
-	clearInterval(keepAlive);
-
-	ws.send(JSON.stringify({
-	    type: 'disconnect'
-	}, function ack() {
-	    ws.close();
-	}));
+	attachTo = process.argv.slice(2).find(arg => {
+	    arg = arg.replace(/-/g, '');
+	    return !commandLineOptions.hasOwnProperty(arg) // not a long option
+		&& !commandLineOptionsConfig.find(opt => opt.short === arg); // and not a short option
+	});
     } catch (e) {
+	// uncomment this for debugging:
+	// console.error('error',e);
     }
-});
 
-
-    repl(wskprops, eventBus);
+    repl(wskprops, eventBus, attachTo);
 });
 
 ws.on('close', function() {