Fossil

Check-in [15c6caf2]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed Ctrl-D handling in rhino-based shell.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | json-multitag-test | json
Files: files | file ages | folders
SHA1:15c6caf29ece4354b90ffd1325ad02e6500b8b7d
User & Date: stephan 2011-10-08 14:36:56
Context
2011-10-08
15:13
accommodated API change. check-in: 69ef388f user: stephan tags: json-multitag-test, json
14:36
Fixed Ctrl-D handling in rhino-based shell. check-in: 15c6caf2 user: stephan tags: json-multitag-test, json
14:16
added /json/report/get. check-in: e21b391d user: stephan tags: json-multitag-test, json
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ajax/i-test/rhino-shell.js.

105
106
107
108
109
110
111
112

113
114
115
116
117
118
119
...
139
140
141
142
143
144
145









146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
...
165
166
167
168
169
170
171

172
173
174
175
176
177
178
179
180
181



182


183


184
185
186

187
188
189
FShell.readline = (typeof readline === 'function') ? (readline) : (function() {
     importPackage(java.io);
     importPackage(java.lang);
     var stdin = new BufferedReader(new InputStreamReader(System['in']));
     var self = this;
     return function(prompt) {
        if(prompt) print(prompt);
        return String(stdin.readLine()); 

     };
}());

FShell.dispatchLine = function(line){
    var av = line.split(' '); // FIXME: to shell-like tokenization. Too tired!
    var cmd = av[0];
    var key, h;
................................................................................
        print("Payload: "+(resp.payload ? WhAjaj.stringify(resp.payload) : "none"));
        if(WhAjaj.isFunction(callback)){
            callback(resp,req);
        }
    };
};
FShell.commandHandlers = {









    "/":function(args){
        FShell.fossil.sendCommand('/json'+args[0],undefined,{
            beforeSend:function(req,opt){
                print("Sending to: "+opt.url);
            },
            onResponse:FShell.onResponseDefault()
        });
    },
    "e":function(args){
        eval(args.join(' '));
    },
    "login":function(args){
        FShell.fossil.login(args[1], args[2], {
            onResponse:FShell.onResponseDefault()
        });
    },
................................................................................
        });
    },
    "HAI":function(args){
        FShell.fossil.HAI({
            onResponse:FShell.onResponseDefault()
        });
    }

};
FShell.commandAliases = {
    "li":"login",
    "lo":"logout",
    "who":"whoami",
    "hi":"HAI",
    "tci":"/timeline/ci?limit=3"
};
FShell.mainLoop = function(){
    var line;



    while( null != (line = this.readline(this.prompt)) ){


        //print("Got line: "+line);


        this.dispatchLine(line);
        print("");
    }

};

FShell.mainLoop();







|
>







 







>
>
>
>
>
>
>
>
>








|







 







>










>
>
>
|
>
>

>
>



>



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
...
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
FShell.readline = (typeof readline === 'function') ? (readline) : (function() {
     importPackage(java.io);
     importPackage(java.lang);
     var stdin = new BufferedReader(new InputStreamReader(System['in']));
     var self = this;
     return function(prompt) {
        if(prompt) print(prompt);
        var x = stdin.readLine();
        return null===x ? x : String(x) /*convert to JS string!*/;
     };
}());

FShell.dispatchLine = function(line){
    var av = line.split(' '); // FIXME: to shell-like tokenization. Too tired!
    var cmd = av[0];
    var key, h;
................................................................................
        print("Payload: "+(resp.payload ? WhAjaj.stringify(resp.payload) : "none"));
        if(WhAjaj.isFunction(callback)){
            callback(resp,req);
        }
    };
};
FShell.commandHandlers = {
    "?":function(args){
        var k;
        print("Available commands...\n");
        var o = FShell.commandHandlers;
        for(k in o){
            if(! o.hasOwnProperty(k)) continue;
            print("\t"+k);
        }
    },
    "/":function(args){
        FShell.fossil.sendCommand('/json'+args[0],undefined,{
            beforeSend:function(req,opt){
                print("Sending to: "+opt.url);
            },
            onResponse:FShell.onResponseDefault()
        });
    },
    "eval":function(args){
        eval(args.join(' '));
    },
    "login":function(args){
        FShell.fossil.login(args[1], args[2], {
            onResponse:FShell.onResponseDefault()
        });
    },
................................................................................
        });
    },
    "HAI":function(args){
        FShell.fossil.HAI({
            onResponse:FShell.onResponseDefault()
        });
    }

};
FShell.commandAliases = {
    "li":"login",
    "lo":"logout",
    "who":"whoami",
    "hi":"HAI",
    "tci":"/timeline/ci?limit=3"
};
FShell.mainLoop = function(){
    var line;
    var check = /\S/;
    //var isJavaNull = /java\.lang\.null/;
    //print(typeof java.lang['null']);
    while( null != (line=this.readline(this.prompt)) ){
        if(null===line) break /*EOF*/;
        else if( "" === line ) continue;
        //print("Got line: "+line);
        else if(!check.test(line)) continue;
        print('typeof line = '+typeof line);
        this.dispatchLine(line);
        print("");
    }
    print("Bye!");
};

FShell.mainLoop();