feature(console) prompt: add current directory

This commit is contained in:
coderaiser 2014-07-01 07:31:04 -04:00
parent a8cd16b06a
commit 81e75d9ca5
2 changed files with 15 additions and 13 deletions

View file

@ -46,6 +46,12 @@ var CloudCmd, Util, DOM, CloudFunc, $;
this.show = show;
// Handle a command.
function handler(command) {
if (command)
Socket.emit(CHANNEL, command);
}
function show(callback) {
if (!Loading) {
Images.showLoad({top:true});
@ -62,17 +68,6 @@ var CloudCmd, Util, DOM, CloudFunc, $;
jqconsole.AbortPrompt();
handler();
});
// Handle a command.
var handler = function(command) {
if (command)
Socket.emit(CHANNEL, command);
jqconsole.Prompt(true, handler);
};
// Initiate the first prompt.
handler();
}
CloudCmd.View.show(Element, {
@ -175,7 +170,12 @@ var CloudCmd, Util, DOM, CloudFunc, $;
log(json.stdout);
error(json.stderr);
if (json.path)
jqconsole.SetPromptLabel(json.path + '>');
}
jqconsole.Prompt(true, handler);
}
init();

View file

@ -72,10 +72,12 @@
if (!Clients[ConNum]) {
msg = log(ConNum, 'console connected');
Util.exec(callback, {
stdout : addNewLine(msg)
callback({
stdout : addNewLine(msg),
path : process.cwd()
});
Clients[ConNum] = true;
onMessage = Util.exec.with(getOnMessage, ConNum, callback);