mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-08-01 20:22:29 +00:00
feature(console) prompt: add current directory
This commit is contained in:
parent
a8cd16b06a
commit
81e75d9ca5
2 changed files with 15 additions and 13 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue