-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.es
62 lines (54 loc) · 1.67 KB
/
profile.es
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
const path (import "$eslang/path");
const (get-help, add-help) (import (get add) from "./tools/help");
const gray (= text (printf text, "gray");
const blue (= text (printf text, "blue");
const yellow (= text (printf text, "yellow");
# secret aliases of exit.
(if (env "runtime-host":: is "native")
export (bye quit) (->() (exit );
else
export reload (->() (exit );
).
# display runtime version
(export version (=> ()
run (path resolve (env "runtime-home"), "tools/version");
).
version;
# display shell object information.
gray "# object "; yellow ".loader"; gray ", and functions ";
blue ".echo"; gray ", "; blue ".debug"; gray " and "; blue ".logging";
gray " are imported.\n";
gray "# functions "; blue "version"; gray ", ";
blue "desc/describe";
(export (desc, describe) (=> it
(if ($it is-an object)
(object fields-of it:: sort:: for-each (=> p
print '$p # $(type of ($it:p))';
).
else
($it is-an array:: ? it, (@ it):: for-each (=> (v i)
print '#($(i), $(type of v))# $v';
).
gray " and operators "; blue "help";
(export help (=? (subject, topic)
"try '(help)' or 'help;' to ask for help."
local "content" ((. get-help) (subject key) (topic key);
(if (content is-empty)
"not available."; false
else
print content; true
).
gray ", "; blue "selftest";
(export selftest (=? spec
"try '(selftest)' or 'selftest;' to run all specifications."
(if (spec is-empty)
test-bootstrap;
run "test/test", null, (env "runtime-home");
else
(spec key:: is "bootstrap":: ? (test-bootstrap ),
(run "test/test",
(operation slice operand:: to-array:: map (= p (p key).
(env "runtime-home")
).
).
gray " are imported.\n";