on master help sign in
a sensible shell
4704504Galen Wolfe-Pauly
docs/walkthroughs/shell.md+154−11
@@ -27,6 +27,10 @@ Use `=var` to save a shell variable:
27
27
28 ~fintud-macrep:dojo> =foo (add 2 2)
28 ~fintud-macrep:dojo> =foo (add 2 2)
29
29
30+Use `=dir` to set the current working directory:
31+
32+ ~fintud-macrep:dojo> =dir %/web
33+
30Generators (files in `/gen`) are run with `+`:
34Generators (files in `/gen`) are run with `+`:
31
35
32 ~fintud-macrep:dojo> +hello 'world'
36 ~fintud-macrep:dojo> +hello 'world'
@@ -35,30 +39,169 @@ Save output to a file in `%clay` with `*`:
35
39
36 ~fintud-macrep:dojo> *foo/bar/hoon 'hello world'
40 ~fintud-macrep:dojo> *foo/bar/hoon 'hello world'
37
41
38−A system command to `:hood` using `|`:
42+Run system commands from `:hood`, like `reload`, using `|`:
39
43
40 ~fintud-macrep:dojo> |reload %eyre
44 ~fintud-macrep:dojo> |reload %eyre
41
45
42−# dir
43−
44## Manual
46## Manual
45
47
46−# special vars
48+<h3 class="first child">Sources and sinks</h3>
49+
50+A dojo command is either a source or a sink. A source is just something that can be printed to your console or the result of some computation. A sink is an *effect*: a change to the filesystem, a network message, a change to your environment, or typed message to an app.
51+
52+Sources can be chained together, but we can only produce one effect per command.
53+
54+### Sinks
55+
56+### `=` - Set variable
57+
58+Set any envronment variable:
59+
60+ ~fintud-macrep:dojo> =foo 42
61+ ~fintud-macrep:dojo> (add 2 foo)
47
62
48−# command prefixes
63+ 44
49
64
50−### `:` send to app
65+(There are a few special variables that the dojo expects. See below.)
51
66
52−Send a poke message to `:square` as an `atom` mark:
67+### `:` - Send to app
53
68
54− ~fintud-macrep:dojo> :~fintud-macrep/square &atom (add 2 2)
69+ ~fintud-macrep:dojo> :hood &helm-hi 'hi'
55
70
71+### `*` - Save in `%clay`
72+
73+ ~fintud-macrep:dojo> *%/web/foo/md '# hello'
74+
56−### `.` download to Unix
75+### `.` - Download to Unix
57
76
58Download a noun to Unix with `.`:
77Download a noun to Unix with `.`:
59
78
60 ~fintud-macrep:dojo> .foo/bar/baz (add 2 2)
79 ~fintud-macrep:dojo> .foo/bar/baz (add 2 2)
61
80
62−# generators
81+### Sources
82+
83+### `&` - Mark conversion
84+
85+### `_` - Run a function
86+
87+ _trip &html &md 'foo'
88+
89+### `+` `-` - HTTP requests
90+
91+ +http://google.com is get
92+ +http://google.com &json (joba %a ~) is post {a:null}
93+ -http://localhost:6000/foobar &json (joba %a ~) is put {a:null}
94+
95+ +curl "http://google.com?q={(urle "my params")}"
96+ the trivial generator that sends a get request, the baseline on which you could write a scraper
97+
98+### `+` - Generators
99+
100+### `[1 2 +hello 'world']` - Tuples
101+
102+<h3 class="first child">Variables</h3>
103+
104+You can use `=` to set an environment variable in `:dojo`, but there are a few reserved names that have special uses.
105+
106+#### `dir`
107+
108+Current working `%clay` desk and revision. Read / write.
109+
110+**Examples:**
111+
112+ ~fintud-macrep:dojo> =dir %/web
113+ ~fintud-macrep:dojo> +ls %
114+
115+ 404/hoon docs/ dojo/hoon lib/ listen/hoon md static/md talk/ tree/main/
116+
117+#### `lib`
118+
119+Current set of libraries (`/lib`) in your environment. Can also be set with `/+`. Read / write.
120+
121+**Examples:**
122+
123+ ~fintud-macrep:dojo> =lib ~[[%react ~]]
124+ ~fintud-macrep:dojo> :: this also works:
125+ ~fintud-macrep:dojo> /+ react
126+ ~fintud-macrep:dojo> :: now we can use arms from lib/react.hoon
127+ ~fintud-macrep:dojo> (react-vale:react %div)
128+
129+#### `sur`
130+
131+Current set of structures (`/sur`) in your environment. Can also be set with `/-`. Read / write.
132+
133+**Examples:**
134+
135+ ~fintud-macrep:dojo> =sur ~[[%sole ~]]
136+ ~fintud-macrep:dojo> :: this also works:
137+ ~fintud-macrep:dojo> /- sole
138+ ~fintud-macrep:dojo> :: now we can use arms in sur/sole.hoon
139+ ~fintud-macrep:dojo> `sole-effect:sole`[%bel ~]
140+
141+#### `now`
142+
143+The current (128-bit `@da`) time. Read-only.
144+
145+**Example:**
146+
147+ ~fintud-macrep:dojo> now
148+
149+ ~2016.3.21..21.10.57..429a
150+
151+#### `our`
152+
153+The current urbit plot. Read-only.
154+
155+**Example:**
156+
157+ ~fintud-macrep:dojo> our
158+
159+ ~fintud-macrep
160+
161+#### `eny`
162+
163+256 bits of entropy. Read-only.
164+
165+**Example:**
166+
167+ ~fintud-macrep:dojo> eny
168+
169+ 0v1o.m2vio.j5ieb.7tq84.5kcnp.gjn04.9gl2e.tkj5v.0oqk3.iugk8.rhu6o
170+
171+# Generators
172+
173+#### `+cat`
174+
175+#### `+curl` / `+curl-hiss`
176+
177+#### `+hello`
178+
179+#### `+ls`
180+
181+#### `+moon`
182+
183+#### `+pope`
184+
185+#### `+solid`
186+
187+#### `+ticket`
188+
189+#### `+tree`
190+
191+# Hood
192+
193+`|hi`
194+
195+`|ask`
196+
197+`|begin`
198+
199+`|link` / `|unlink`
200+
201+`|mass`
202+
203+`|reload`
204+
205+`|reset`
63
206
64−# hood
207+`|start`
docs/walkthroughs/web.md+7
@@ -8,6 +8,7 @@ title: Web
8
8
9General coverage of Urbit on the web. Renderer -> file, main public facing files, and tree. Then:
9General coverage of Urbit on the web. Renderer -> file, main public facing files, and tree. Then:
10
10
11+
11## Tree
12## Tree
12
13
13Tree is a simple publishing platform for files that live on your Urbit. You're probably reading this file using Tree right now. The main driving use-case for Tree has been for us to host our own documentation and the surrounding discussion. Tree remains a pretty simple and flexible tool for getting content online. We think it's pretty great.
14Tree is a simple publishing platform for files that live on your Urbit. You're probably reading this file using Tree right now. The main driving use-case for Tree has been for us to host our own documentation and the surrounding discussion. Tree remains a pretty simple and flexible tool for getting content online. We think it's pretty great.
@@ -20,6 +21,12 @@ Your Urbit comes with a pre-built copy of the tree (as a single `.js` file). If
20
21
21You don't need to know anything about the tree implementation to use it, so we'll start with that and get further into the technical details as we get down the page.
22You don't need to know anything about the tree implementation to use it, so we'll start with that and get further into the technical details as we get down the page.
22
23
24+## Renderers
25+
26+## `/web`
27+
28+`|serve`
29+
23## Publishing files
30## Publishing files
24
31
25Assuming you have an Urbit desk mounted (if not see the [Filesystem Handbook](/walkthroughs/clay)), try opeing up `/web/static.md` in an editor and `http://localhost:8080/static` side by side.
32Assuming you have an Urbit desk mounted (if not see the [Filesystem Handbook](/walkthroughs/clay)), try opeing up `/web/static.md` in an editor and `http://localhost:8080/static` side by side.