feature(package) console-io v3.0.0

This commit is contained in:
coderaiser 2016-11-15 15:59:00 +02:00
parent 2c024d10ba
commit 76125f45ae
4 changed files with 37 additions and 10 deletions

14
HELP.md
View file

@ -198,6 +198,20 @@ Console
For more details see [console hot keys](https://github.com/cloudcmd/console#hot-keys "Console Hot Keys").
Every program executed in `console` has these `environment` variables:
- `ACTIVE_DIR` - directory that contains cursor
- `PASSIVE_DIR` - directory with no cursor
- `CURRENT_NAME` - name of a file under cursor
- `CURRENT_PATH` - path to file under cursor
On Unix you can use it this way:
```sh
~> echo $CURRENT_PATH
/home/coderaiser/cloudcmd/bin/cloudcmd.js
```
Config
---------------
![Config](/img/screen/config.png "Config")

View file

@ -30,7 +30,7 @@
Konsole.show,
]);
Element = DOM.load({
Element = DOM.load({
name : 'div',
className : 'console'
});
@ -48,11 +48,25 @@
return CloudCmd.PREFIX + '/console';
}
function getEnv() {
return {
ACTIVE_DIR: DOM.getCurrentDirPath.bind(DOM),
PASSIVE_DIR: DOM.getNotCurrentDirPath.bind(DOM),
CURRENT_NAME: DOM.getCurrentName.bind(DOM),
CURRENT_PATH: function() {
return DOM.CurrentInfo.path;
}
}
}
function create(callback) {
var prefix = getPrefix(),
socketPath = CloudCmd.PREFIX;
var options = {
env: getEnv(),
prefix: getPrefix(),
socketPath: CloudCmd.PREFIX,
};
Console(Element, prefix, socketPath, function(spawn) {
Console(Element, options, function(spawn) {
spawn.on('connect', exec.with(authCheck, spawn));
Util.exec(callback);
});
@ -62,7 +76,7 @@
var command = Console.getPromptText(),
path = DOM.getCurrentDirPath();
command += path;
command += path;
Console.setPromptText(command);
}
});

View file

@ -18,7 +18,7 @@ var DIR = __dirname + '/',
ponse = require('ponse'),
mollify = require('mollify'),
restafary = require('restafary'),
webconsole = require('console-io'),
konsole = require('console-io/legacy'),
edward = require('edward/legacy'),
dword = require('dword/legacy'),
deepword = require('deepword/legacy'),
@ -147,9 +147,8 @@ function listen(prefix, socket) {
authCheck: authCheck
});
config('console') && webconsole({
config('console') && konsole.listen(socket, {
prefix: prefix + '/console',
socket: socket,
authCheck: authCheck
});
}
@ -170,7 +169,7 @@ function cloudcmd(prefix) {
}),
funcs = [
webconsole.middle({
konsole({
prefix: prefix + '/console',
minify: isMinify,
online: isOnline

View file

@ -90,7 +90,7 @@
"apart": "^1.0.1",
"chalk": "^1.1.0",
"checkup": "^1.3.0",
"console-io": "^2.7.1",
"console-io": "^3.0.0",
"copymitter": "^1.8.0",
"criton": "^1.0.0",
"deepword": "^1.1.2",