mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
feature(package) console-io v3.0.0
This commit is contained in:
parent
2c024d10ba
commit
76125f45ae
4 changed files with 37 additions and 10 deletions
14
HELP.md
14
HELP.md
|
|
@ -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
|
||||
---------------
|
||||

|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue