@@ -8,16 +8,12 @@
9# Shell (Dojo)
9# Shell (Dojo)
12− ;div(class "col-md-8")
14The Dojo is our shell; it processes system commands and returns output. It's a
12The Dojo is our shell; it processes system commands and returns output. It's a
15good place to quickly experiment with Urbit. On the surface the Dojo is just a
13good place to quickly experiment with Urbit. On the surface the Dojo is just a
16Hoon REPL. On the inside, the Dojo is a system for operating on and transforming
14Hoon REPL. On the inside, the Dojo is a system for operating on and transforming
17data in Urbit.
15data in Urbit.
22## Quickstart
18## Quickstart
@@ -37,26 +33,25 @@ Tall-form Hoon may require multiple lines:
39~your-urbit:dojo> %+ add
35~your-urbit:dojo> %+ add
40−~your-urbit:dojo< 2
36+~your-urbit:dojo< 2
41~your-urbit:dojo< 2
37~your-urbit:dojo< 2
44−Hoon uses something called [the subject](/../../tutorials/hoon-ch1/hoon-ch1-3).
40+Hoon uses something called [the subject](../../tutorials/hoon-ch1/hoon-ch1-3).
45−The Dojo has its own subject, and that's where Hoon's equivalent of variables
41+The Dojo has its own subject, and that's where Hoon's equivalent of variables,
46−are stored.
42+called faces, are stored.
48−Use `=var` to save variable to the Dojo subject.
44+Use `=var` to save faces to the Dojo subject.
51~your-urbit:dojo> =foo (add 2 2)
47~your-urbit:dojo> =foo (add 2 2)
54Note, however, that `=var` is Dojo syntax, not Hoon syntax. You cannot bind a
50Note, however, that `=var` is Dojo syntax, not Hoon syntax. You cannot bind a
55−variable in a `.hoon` file in this way.
51+face in a `.hoon` file in this way.
57##### System Commands
53##### System Commands
60Use `=dir` to set the current working directory:
55Use `=dir` to set the current working directory:
@@ -84,76 +79,92 @@ Run system commands from `:hood`, like `reload`, using `|`:
84~your-urbit:dojo> |reload %eyre
79~your-urbit:dojo> |reload %eyre
87−`_See the [Clay](../fileystem) page for more information on system commands.`
89### Generators
82### Generators
91Generators are short Hoon scripts, saved as `.hoon` files in the `/gen`
84Generators are short Hoon scripts, saved as `.hoon` files in the `/gen`
92directory. Many Dojo commands exist in the form of generators. The syntax for
85directory. Many Dojo commands exist in the form of generators. The syntax for
93running a generator is `+genname` for a generator saved as `genname.hoon`.
86running a generator is `+genname` for a generator saved as `genname.hoon`.
95−`+cat` - Accepts a path and displays the file. Similar to Unix `cat`.
90+Accepts a path and displays the file. Similar to Unix `cat`.
98−~your-urbit:dojo> +cat /~talsur-todres/home/gen/curl/hoon
93+~your-urbit:dojo> +cat %/gen/curl/hoon
101−`+code` - Generates a code to remotely log into your ship.
98+Generates a code that is used to remotely log into your ship. No
104~your-urbit:dojo> +code
102~your-urbit:dojo> +code
107−`+curl` - Retrives data from a URL. Accepts a `tape`. Similar to Unix
107+Retrives data from a URL. Accepts a `tape`. Similar to Unix `curl`.
111~your-urbit:dojo> +curl "http://nyt.com"
110~your-urbit:dojo> +curl "http://nyt.com"
114−`+hello` - Just prints the argument. Accepts a `@ta`.
115+Just prints the argument. Accepts a `@ta`.
117~your-urbit:dojo> +hello 'mars'
118~your-urbit:dojo> +hello 'mars'
120−`+ls` - Similar to Unix `ls`. Accepts a path.
123+Similar to Unix `ls`. Accepts a path.
123~your-urbit:dojo> +ls %/web
126~your-urbit:dojo> +ls %/web
124~your-urbit:dojo> +ls /~talsur-todres/home/2/web/notes
127~your-urbit:dojo> +ls /~talsur-todres/home/2/web/notes
127−`+moon` - Generates a random moon from a planet. No arguments.
132+Generates a random moon from a planet. No arguments.
130~your-urbit:dojo> +moon
135~your-urbit:dojo> +moon
133−`+solid` - Compile the current state of the kernel and output a
138+##### +solid
134−noun. Usually downloaded to a file in unix. No arguments.
140+Compile the current state of the kernel and output a
141+noun. Usually downloaded to a file in unix. No arguments.
138~your-urbit:dojo> .urbit/pill +solid
144~your-urbit:dojo> .urbit/pill +solid
141−`+test` - Testrunner. Can test multiple generators at once, conventionally ones
149+Testrunner. Can test multiple generators at once, conventionally ones
142−in the `/test` folder. Accepts a path.
150+in the `/test` folder. Takes a path.
145~your-urbit:dojo> +test /lib
153~your-urbit:dojo> +test /lib
148−`+ticket` - Generate a ticket for an Urbit plot. Takes an Urbit name
158+Generate a ticket for an Urbit ship. Takes an Urbit name (`@p`).
153~your-urbit:dojo> +ticket ~talsur-todres-your-urbit
162~your-urbit:dojo> +ticket ~talsur-todres-your-urbit
156−`+tree` - Generate a recursive directory listing. Takes a path.
167+Generate a recursive directory listing. Takes a path.
159~your-urbit:dojo> +tree %/web
170~your-urbit:dojo> +tree %/web
@@ -170,7 +181,7 @@ an urbit name (`@p`) and a string (`tape`, which is text wrapped with double-quo
170~your-urbit:dojo> |hi ~binzod "you there?"
181~your-urbit:dojo> |hi ~binzod "you there?"
173−`|link` / `|unlink - Link / unlink a remote app. Accepts an
184+`|link` / `|unlink` - Link / unlink a remote app. Accepts an
174Urbit name and an app name.
185Urbit name and an app name.
@@ -191,25 +202,27 @@ number of vane names.
191~your-urbit:dojo> |reload %clay %eyre
202~your-urbit:dojo> |reload %clay %eyre
194−**`|reset`** - Reloads `hoon.hoon` and all modules. No arguments.
205+*`|reset`* - Reloads `hoon.hoon` and all modules. No arguments.
197~your-urbit:dojo> |reset
208~your-urbit:dojo> |reset
200−**`|start`** - Starts an app. Accepts an app name.
211+*`|start`* - Starts an app. Accepts an app name.
203~your-urbit:dojo> |start %curl
214~your-urbit:dojo> |start %curl
208;h3(class "first child")
221;h3(class "first child")
209Sources and sinks
222Sources and sinks
212−A dojo command is either a source or a sink. A source is just something
225+A Dojo command is either a *source* or a *sink*. A source is just something
213that can be printed to your console or the result of some computation. A
226that can be printed to your console or the result of some computation. A
214sink is an *effect*: a change to the filesystem, a network message, a
227sink is an *effect*: a change to the filesystem, a network message, a
215change to your environment, or typed message to an app.
228change to your environment, or typed message to an app.
@@ -233,11 +246,11 @@ Set any environment variable:
233Make sure to note that `=var` is Dojo syntax, not Hoon syntax. You cannot bind a
246Make sure to note that `=var` is Dojo syntax, not Hoon syntax. You cannot bind a
234variable in a `.hoon` file in this way.
247variable in a `.hoon` file in this way.
236−#### Special Variables
249+##### Special Variables
238−There are a few special variables that the dojo maintains.
251+There are a few special variables that the Dojo maintains.
240−#### `:` - Send to app
253+##### `:` - Send to app
242`:app` goes to a local `app`, `:~ship/app` goes to the `app` on `~ship`.
255`:app` goes to a local `app`, `:~ship/app` goes to the `app` on `~ship`.
@@ -249,18 +262,18 @@ Send a `helm-hi` message to `hood`:
250Apps usually expect marked data, so `&` is often used here.
263Apps usually expect marked data, so `&` is often used here.
252−#### `*` - Save in `%clay`
265+##### `*` - Save in `%clay`
254−Save a new `md` file in `web`:
267+Save a new `.umd` file in `web`:
257−~your-urbit:dojo> *%/web/foo/md '# hello'
270+~your-urbit:dojo> *%/web/foo/umd '# hello'
260The last component of the path is expected to be the mark (or mime
273The last component of the path is expected to be the mark (or mime
263−#### `.` - Export to Unix
276+##### `.` - Export to Unix
265Export a noun to Unix with `.`:
278Export a noun to Unix with `.`:
@@ -280,7 +293,7 @@ Which outputs a new `urbit.pill` to `pier/.urb/put/urbit.pill`
281### Sources
294### Sources
283−#### `&` - Mark conversion
296+##### `&` - Mark conversion
285Convert between marks using `&`:
298Convert between marks using `&`:
@@ -289,14 +302,14 @@ Convert between marks using `&`:
289'<html><head></head><body><div><h1 id="-hello">hello</h1></div></body></html>'
302'<html><head></head><body><div><h1 id="-hello">hello</h1></div></body></html>'
292−#### `_` - Run a function
305+##### `_` - Run a function
294Use `_` to run a gate (or function):
307Use `_` to run a gate (or function):
296Write an arbitrary function and pass data to it:
309Write an arbitrary function and pass data to it:
299−~your-urbit:dojo> _|=({a/@} (mul a 3)) 3
312+~your-urbit:dojo> _|=([a=@] (mul a 3)) 3
@@ -307,7 +320,7 @@ Use a function to get the status code from an http request:
310−#### `+` `-` - HTTP requests
323+##### `+` `-` - HTTP requests
312`+http[s]://example.com` - sends a GET request
325`+http[s]://example.com` - sends a GET request
@@ -319,16 +332,17 @@ JSON `"hi"` in the body.
320Note that the first of these is a source while the last two are sinks.
333Note that the first of these is a source while the last two are sinks.
322−#### `+` - Generators
335+##### `+` - Generators
324−Generators are simple hoon scripts loaded from the filesystem. They live
337+Generators are simple Hoon scripts loaded from the filesystem. They live
325in `gen/`.
338in `gen/`.
327−Create a random moon (from any planet):
340+An example of a generator that is built into your urbit is `+code`. It produces
341+the code needed to log into your ship remotely.
330−~your-urbit:dojo> +moon
344+~your-urbit:dojo> +code
331−"moon: ~docsun-tamtem-your-urbit; ticket: ~bartug-hodbyr-fognum-ralmud"
345+fintyr-haldet-fassev-solhex
334### Variables
348### Variables
@@ -336,53 +350,49 @@ Create a random moon (from any planet):
336You can use `=` to set an environment variable in Dojo, but there are
350You can use `=` to set an environment variable in Dojo, but there are
337a few reserved names that have special uses.
351a few reserved names that have special uses.
339−#### `dir`
353+##### dir
341Current working `%clay` desk and revision. Read / write.
355Current working `%clay` desk and revision. Read / write.
343−**Examples:**
357+*Examples:*
346~your-urbit:dojo> =dir %/web
360~your-urbit:dojo> =dir %/web
347~your-urbit:dojo> +ls %
361~your-urbit:dojo> +ls %
348−404/hoon docs/ dojo/hoon lib/ listen/hoon md static/md talk/ tree/main/
362+404/hoon docs/ dojo/hoon lib/ listen/hoon md static/umd talk/ testing/umd tree/main/ unmark/ womb/
351−#### `lib`
365+##### lib
353−Current set of libraries (`/lib`) in your environment. Can also be set
367+Current set of libraries (`/lib`) in your environment. Can be set
354with `/+`. Read / write.
368with `/+`. Read / write.
356−**Examples:**
370+*Examples:*
359−~your-urbit:dojo> =lib ~[[%react ~]]
360−~your-urbit:dojo> :: this also works:
361~your-urbit:dojo> /+ react
373~your-urbit:dojo> /+ react
362~your-urbit:dojo> :: now we can use arms from lib/react.hoon
374~your-urbit:dojo> :: now we can use arms from lib/react.hoon
363~your-urbit:dojo> (react-vale:react %div)
375~your-urbit:dojo> (react-vale:react %div)
366−#### `sur`
378+##### sur
368−Current set of structures (`/sur`) in your environment. Can also be set
380+Current set of structures (`/sur`) in your environment. Can be set
369with `/-`. Read / write.
381with `/-`. Read / write.
371−**Examples:**
383+*Examples:*
374−~your-urbit:dojo> =sur ~[[%sole ~]]
375−~your-urbit:dojo> :: this also works:
376~your-urbit:dojo> /- sole
386~your-urbit:dojo> /- sole
377~your-urbit:dojo> :: now we can use arms in sur/sole.hoon
387~your-urbit:dojo> :: now we can use arms in sur/sole.hoon
378~your-urbit:dojo> `sole-effect:sole`[%bel ~]
388~your-urbit:dojo> `sole-effect:sole`[%bel ~]
381−#### `now`
391+##### now
383The current (128-bit `@da`) time. Read-only.
393The current (128-bit `@da`) time. Read-only.
385−**Example:**
395+*Example:*
388~your-urbit:dojo> now
398~your-urbit:dojo> now
@@ -390,11 +400,11 @@ The current (128-bit `@da`) time. Read-only.
390~2016.3.21..21.10.57..429a
400~2016.3.21..21.10.57..429a
393−#### `our`
403+##### our
395−The current urbit plot. Read-only.
405+The current urbit ship. Read-only.
397−**Example:**
407+*Example:*
400~your-urbit:dojo> our
410~your-urbit:dojo> our
@@ -402,11 +412,11 @@ The current urbit plot. Read-only.
402~your-urbit
412~your-urbit
405−#### `eny`
415+##### eny
407512 bits of entropy. Read-only.
417512 bits of entropy. Read-only.
409−**Example:**
419+*Example:*
412~your-urbit:dojo> eny
422~your-urbit:dojo> eny
@@ -419,5 +429,5 @@ The current urbit plot. Read-only.
419## Troubleshooting
429## Troubleshooting
421If you encounter `%dy-edit-busy` while entering commands, it is
431If you encounter `%dy-edit-busy` while entering commands, it is
422−because your dojo is blocked on a timer or an http request. Type backspace
432+because your Dojo is blocked on a timer or an HTTP request. Type backspace
423−and your dojo will end the blocked command.
433+and your Dojo will end the blocked command.