File tree Expand file tree Collapse file tree 4 files changed +37
-10
lines changed
Expand file tree Collapse file tree 4 files changed +37
-10
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,20 @@ Console
198198
199199For more details see [ console hot keys] ( https://github.com/cloudcmd/console#hot-keys " Console Hot Keys ") .
200200
201+ Every program executed in ` console ` has these ` environment ` variables:
202+
203+ - ` ACTIVE_DIR ` - directory that contains cursor
204+ - ` PASSIVE_DIR ` - directory with no cursor
205+ - ` CURRENT_NAME ` - name of a file under cursor
206+ - ` CURRENT_PATH ` - path to file under cursor
207+
208+ On Unix you can use it this way:
209+
210+ ``` sh
211+ ~ > echo $CURRENT_PATH
212+ /home/coderaiser/cloudcmd/bin/cloudcmd.js
213+ ```
214+
201215Config
202216---------------
203217![ Config] ( /img/screen/config.png " Config ")
Original file line number Diff line number Diff line change 3030 Konsole . show ,
3131 ] ) ;
3232
33- Element = DOM . load ( {
33+ Element = DOM . load ( {
3434 name : 'div' ,
3535 className : 'console'
3636 } ) ;
4848 return CloudCmd . PREFIX + '/console' ;
4949 }
5050
51+ function getEnv ( ) {
52+ return {
53+ ACTIVE_DIR : DOM . getCurrentDirPath . bind ( DOM ) ,
54+ PASSIVE_DIR : DOM . getNotCurrentDirPath . bind ( DOM ) ,
55+ CURRENT_NAME : DOM . getCurrentName . bind ( DOM ) ,
56+ CURRENT_PATH : function ( ) {
57+ return DOM . CurrentInfo . path ;
58+ }
59+ }
60+ }
61+
5162 function create ( callback ) {
52- var prefix = getPrefix ( ) ,
53- socketPath = CloudCmd . PREFIX ;
63+ var options = {
64+ env : getEnv ( ) ,
65+ prefix : getPrefix ( ) ,
66+ socketPath : CloudCmd . PREFIX ,
67+ } ;
5468
55- Console ( Element , prefix , socketPath , function ( spawn ) {
69+ Console ( Element , options , function ( spawn ) {
5670 spawn . on ( 'connect' , exec . with ( authCheck , spawn ) ) ;
5771 Util . exec ( callback ) ;
5872 } ) ;
6276 var command = Console . getPromptText ( ) ,
6377 path = DOM . getCurrentDirPath ( ) ;
6478
65- command += path ;
79+ command += path ;
6680 Console . setPromptText ( command ) ;
6781 }
6882 } ) ;
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ var DIR = __dirname + '/',
1818 ponse = require ( 'ponse' ) ,
1919 mollify = require ( 'mollify' ) ,
2020 restafary = require ( 'restafary' ) ,
21- webconsole = require ( 'console-io' ) ,
21+ konsole = require ( 'console-io/legacy ' ) ,
2222 edward = require ( 'edward/legacy' ) ,
2323 dword = require ( 'dword/legacy' ) ,
2424 deepword = require ( 'deepword/legacy' ) ,
@@ -147,9 +147,8 @@ function listen(prefix, socket) {
147147 authCheck : authCheck
148148 } ) ;
149149
150- config ( 'console' ) && webconsole ( {
150+ config ( 'console' ) && konsole . listen ( socket , {
151151 prefix : prefix + '/console' ,
152- socket : socket ,
153152 authCheck : authCheck
154153 } ) ;
155154}
@@ -170,7 +169,7 @@ function cloudcmd(prefix) {
170169 } ) ,
171170
172171 funcs = [
173- webconsole . middle ( {
172+ konsole ( {
174173 prefix : prefix + '/console' ,
175174 minify : isMinify ,
176175 online : isOnline
Original file line number Diff line number Diff line change 9090 "apart" : " ^1.0.1" ,
9191 "chalk" : " ^1.1.0" ,
9292 "checkup" : " ^1.3.0" ,
93- "console-io" : " ^2.7.1 " ,
93+ "console-io" : " ^3.0.0 " ,
9494 "copymitter" : " ^1.8.0" ,
9595 "criton" : " ^1.0.0" ,
9696 "deepword" : " ^1.1.2" ,
You can’t perform that action at this time.
0 commit comments