-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
47 lines (46 loc) · 939 Bytes
/
cli.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var _key = null;
var cd = function(key) {
if (!key) {
return _key = null;
};
_key = key;
};
var cat = function(id) {
if (_key === null) {
return "select namespace";
};
return App.getInstance().models[_key].getByModelId(id);
};
var ls = function() {
if (_key === null) {
var models = App.getInstance().models,
result = [];
for (var model in models) {
result.push(model);
}
return result;
};
return App.getInstance().models[_key].toArray().data.map(function(item) {
return item.model_id;
});
};
var rm = function(id) {
if (_key === null) {
return "select namespace";
};
return App.getInstance().models[_key].getByModelId(id).remove();
};
var pwd = function() {
if (_key === null) {
return "/";
};
return _key;
};
var touch = function(summary) {
if (_key === null) {
return "select namespace";
};
var e = new App.getInstance().models[_key.replace("s", "")];
e.setSummary(summary);
return e;
};