on master help sign in
Merge pull request #1112 from tinnus-napbus/fix-clay-examples-style
ba9bc7ctinnus-napbus
content/docs/arvo/clay/examples.md+26−58
@@ -4,38 +4,6 @@ weight = 7
4template = "doc.html"
4template = "doc.html"
5+++
5+++
6
6
7−# Contents
8−
9−- [Introduction](#introduction)
10−- [%warp](#warp) - Read and Subscribe.
11− - [%sing](#sing) - Read a file or directory.
12− - [%next](#next) - Subscribe for the next change to a file or directory.
13− - [%mult](#mult) - Subscribe for the next change to a set of files and/or directories.
14− - [%many](#many) - Track changes to a `desk` for the specified range of revisions.
15− - [Cancel Subscription](#cancel-subscription)
16−- [%info](#info) - Write and Modify.
17− - [%ins](#ins) - Add a file.
18− - [%del](#del) - Delete a file.
19− - [%mut](#mut) - Change a file.
20− - [Multiple Changes](#multiple-changes) - Change multiple files.
21−- [Manage Mounts](#manage-mounts)
22− - [%boat](#boat) - List mounts.
23− - [%mont](#mont) - Mount something.
24− - [%ogre](#ogre) - Unmount something.
25− - [%dirk](#dirk) - Commit changes.
26−- [Merge Desks](#merge-desks)
27− - [%merg](#merg)
28−- [Permissions](#permissions)
29− - [%perm](#perm) - Set file permissions.
30− - [%cred](#cred) - Add permission group.
31− - [%crew](#crew) - Get permission groups.
32− - [%crow](#crow) - Get group usage.
33−- [Foreign Ships](#foreign-ships)
34− - [%warp](#warp-remote) - Read a file on a foreign ship.
35− - [%merg](#merg-remote) - Merge from a foreign `desk`.
36−
37−# Introduction
38−
39This document contains a number of examples of interacting with Clay using its various `task`s. Sections correspond to the general details in the [API Reference](/docs/arvo/clay/tasks) document.
7This document contains a number of examples of interacting with Clay using its various `task`s. Sections correspond to the general details in the [API Reference](/docs/arvo/clay/tasks) document.
40
8
41Most examples will either use `|pass` to just send a `task` or the following thread to send a `task` and take the resulting `gift`. You can save the following thread to the `ted` directory of your `%home` `desk`:
9Most examples will either use `|pass` to just send a `task` or the following thread to send a `task` and take the resulting `gift`. You can save the following thread to the `ted` directory of your `%home` `desk`:
@@ -61,11 +29,11 @@ Most examples will either use `|pass` to just send a `task` or the following thr
61(pure:m !>(~))
29(pure:m !>(~))
62```
30```
63
31
64−# `%warp`
32+## `%warp`
65
33
66See the [Read and Subscribe](/docs/arvo/clay/tasks#warp---read-and-track) section of the [API Reference](/docs/arvo/clay/tasks) document for general details.
34See the [Read and Subscribe](/docs/arvo/clay/tasks#warp---read-and-track) section of the [API Reference](/docs/arvo/clay/tasks) document for general details.
67
35
68−## `%sing`
36+### `%sing`
69
37
70Here we'll look at reading files by passing Clay a `%warp` `task` with a `%sing` `rave` and receiving a `%writ` `gift` containing the data in response.
38Here we'll look at reading files by passing Clay a `%warp` `task` with a `%sing` `rave` and receiving a `%writ` `gift` containing the data in response.
71
39
@@ -115,7 +83,7 @@ Here's a breakdown of the `task` we sent:
115
83
116![%sing diagram](https://media.urbit.org/docs/arvo/clay/sing.png "%sing diagram")
84![%sing diagram](https://media.urbit.org/docs/arvo/clay/sing.png "%sing diagram")
117
85
118−## `%next`
86+### `%next`
119
87
120Here we'll look at subscribing to the next version of a file by passing Clay a `%warp` `task` with a `%next` `rave` and receiving a `%writ` `gift` when the file changes.
88Here we'll look at subscribing to the next version of a file by passing Clay a `%warp` `task` with a `%next` `rave` and receiving a `%writ` `gift` when the file changes.
121
89
@@ -151,7 +119,7 @@ Here's a breakdown of the task we sent:
151
119
152![%next diagram](https://media.urbit.org/docs/arvo/clay/next.png "%next diagram")
120![%next diagram](https://media.urbit.org/docs/arvo/clay/next.png "%next diagram")
153
121
154−## `%mult`
122+### `%mult`
155
123
156Here we'll look at subscribing to the next version of multiple files by passing Clay a `%warp` `task` with a `%mult` `rave` and receiving a `%wris` `gift` when any of the files change.
124Here we'll look at subscribing to the next version of multiple files by passing Clay a `%warp` `task` with a `%mult` `rave` and receiving a `%wris` `gift` when any of the files change.
157
125
@@ -210,7 +178,7 @@ Here's a breakdown of the `task` we sent:
210
178
211![subscribe mult diagram](https://media.urbit.org/docs/arvo/clay/sub-mult.png "subscribe mult diagram")
179![subscribe mult diagram](https://media.urbit.org/docs/arvo/clay/sub-mult.png "subscribe mult diagram")
212
180
213−## `%many`
181+### `%many`
214
182
215Here we'll look at subscribing to a range of changes to a `desk` by passing Clay a `%warp` `task` with a `%many` `rave` and receiving `%writ` `gift`s when changes occur.
183Here we'll look at subscribing to a range of changes to a `desk` by passing Clay a `%warp` `task` with a `%many` `rave` and receiving `%writ` `gift`s when changes occur.
216
184
@@ -304,7 +272,7 @@ Here's a breakdown of the `task` we sent:
304
272
305![subscribe many diagram](https://media.urbit.org/docs/arvo/clay/sub-many.png "subscribe many diagram")
273![subscribe many diagram](https://media.urbit.org/docs/arvo/clay/sub-many.png "subscribe many diagram")
306
274
307−## Cancel Subscription
275+### Cancel Subscription
308
276
309Here we'll look at cancelling a subscription by sending Clay a `%warp` `task` with a null `(unit rave)` in the `riff`.
277Here we'll look at cancelling a subscription by sending Clay a `%warp` `task` with a null `(unit rave)` in the `riff`.
310
278
@@ -348,11 +316,11 @@ Here's a breakdown of the `task` we sent:
348
316
349![cancel subscription diagram](https://media.urbit.org/docs/arvo/clay/stop-sub.png "cancel subscription diagram")
317![cancel subscription diagram](https://media.urbit.org/docs/arvo/clay/stop-sub.png "cancel subscription diagram")
350
318
351−# `%info`
319+## `%info`
352
320
353See the [Write and Modify](/docs/arvo/clay/tasks#write-and-modify) section of the [API Reference](/docs/arvo/clay/tasks) document for general details.
321See the [Write and Modify](/docs/arvo/clay/tasks#write-and-modify) section of the [API Reference](/docs/arvo/clay/tasks) document for general details.
354
322
355−## `%ins`
323+### `%ins`
356
324
357Here we'll look at adding a file by sending Clay a `%info` `task` containing a `%ins` `miso`.
325Here we'll look at adding a file by sending Clay a `%info` `task` containing a `%ins` `miso`.
358
326
@@ -371,7 +339,7 @@ Here's a breakdown of the `task` we sent:
371
339
372![%ins diagram](https://media.urbit.org/docs/arvo/clay/ins.png)
340![%ins diagram](https://media.urbit.org/docs/arvo/clay/ins.png)
373
341
374−## `%del`
342+### `%del`
375
343
376Here we'll look at deleting a file by sending Clay a `%info` `task` containing a `%del` `miso`.
344Here we'll look at deleting a file by sending Clay a `%info` `task` containing a `%del` `miso`.
377
345
@@ -388,11 +356,11 @@ Here's a breakdown of the `task` we sent:
388
356
389![%del diagram](https://media.urbit.org/docs/arvo/clay/del.png)
357![%del diagram](https://media.urbit.org/docs/arvo/clay/del.png)
390
358
391−## `%mut`
359+### `%mut`
392
360
393Identical to the [%ins](#ins) example, just replace `%ins` with `%mut`.
361Identical to the [%ins](#ins) example, just replace `%ins` with `%mut`.
394
362
395−## Multiple Changes
363+### Multiple Changes
396
364
397Here we'll look at changing multiple files in one request by sending Clay a `%info` `task` containing multiple `miso` in the `soba`.
365Here we'll look at changing multiple files in one request by sending Clay a `%info` `task` containing multiple `miso` in the `soba`.
398
366
@@ -433,11 +401,11 @@ Save to `ted/multi-change.hoon`, `|commit %home`, and run:
433- /~zod/home/38/baz/txt
401- /~zod/home/38/baz/txt
434```
402```
435
403
436−# Manage Mounts
404+## Manage Mounts
437
405
438See the [Manage Mounts](/docs/arvo/clay/tasks#manage-mounts) section of the [API Reference](/docs/arvo/clay/tasks) document for general details.
406See the [Manage Mounts](/docs/arvo/clay/tasks#manage-mounts) section of the [API Reference](/docs/arvo/clay/tasks) document for general details.
439
407
440−## `%boat`
408+### `%boat`
441
409
442Here we'll look at requesting the list of existing mount points on a ship by sending Clay a `%boat` `task` and receiving a `%hill` `gift`.
410Here we'll look at requesting the list of existing mount points on a ship by sending Clay a `%boat` `task` and receiving a `%hill` `gift`.
443
411
@@ -448,7 +416,7 @@ Using the `send-task-take-gift.hoon` thread, let's make such a request:
448[%hill p=~[%home]]
416[%hill p=~[%home]]
449```
417```
450
418
451−## `%mont`
419+### `%mont`
452
420
453Here we'll look at mounting `desk`s, directories and files to unix by sending Clay a `%mont` `task`.
421Here we'll look at mounting `desk`s, directories and files to unix by sending Clay a `%mont` `task`.
454
422
@@ -487,7 +455,7 @@ Let's try mounting a subdirectory and a single folder:
487
455
488If you look in your pier you'll now see a `gen` folder with the contents of `/gen` and a `hi.hoon` file by itself. Notice how the file extension has been automatically added.
456If you look in your pier you'll now see a `gen` folder with the contents of `/gen` and a `hi.hoon` file by itself. Notice how the file extension has been automatically added.
489
457
490−## `%ogre`
458+### `%ogre`
491
459
492Here we'll look at unmounting `desk`s, directories and files by sending Clay a `%ogre` `task`.
460Here we'll look at unmounting `desk`s, directories and files by sending Clay a `%ogre` `task`.
493
461
@@ -518,7 +486,7 @@ If we specify a non-existent mount point it will fail with an error printed to t
518
486
519If we give it an unmounted `beam` it will not print an error but still won't work.
487If we give it an unmounted `beam` it will not print an error but still won't work.
520
488
521−## `%dirk`
489+### `%dirk`
522
490
523Here we'll look at committing changed files by sending Clay a `%dirk` `task`.
491Here we'll look at committing changed files by sending Clay a `%dirk` `task`.
524
492
@@ -535,11 +503,11 @@ Clay will print the changed files to the dojo with a leading `+`, `-` or `:` to
535
503
536If you have the same `desk` mounted to multiple points, a committed change in one mount will also update the others.
504If you have the same `desk` mounted to multiple points, a committed change in one mount will also update the others.
537
505
538−# Merge Desks
506+## Merge Desks
539
507
540See the [Merge Desks](/docs/arvo/clay/tasks#merge-desks) section of the [API Reference](/docs/arvo/clay/tasks) document for general details.
508See the [Merge Desks](/docs/arvo/clay/tasks#merge-desks) section of the [API Reference](/docs/arvo/clay/tasks) document for general details.
541
509
542−## `%merg`
510+### `%merg`
543
511
544Here we'll look at merging `desk`s by sending Clay a `%merg` `task` and receiving a `%mere` `gift` in response.
512Here we'll look at merging `desk`s by sending Clay a `%merg` `task` and receiving a `%mere` `gift` in response.
545
513
@@ -610,11 +578,11 @@ Now change the text in the `foo.txt` in the `%home` `desk`, hit backspace to det
610
578
611You can also specify it by revision number or label.
579You can also specify it by revision number or label.
612
580
613−# Permissions
581+## Permissions
614
582
615See the [Permissions](/docs/arvo/clay/tasks#permissions) section of the [API Reference](/docs/arvo/clay/tasks) document for general details.
583See the [Permissions](/docs/arvo/clay/tasks#permissions) section of the [API Reference](/docs/arvo/clay/tasks) document for general details.
616
584
617−## `%perm`
585+### `%perm`
618
586
619Here we'll look at setting permissions by sending Clay a `%perm` `task`.
587Here we'll look at setting permissions by sending Clay a `%perm` `task`.
620
588
@@ -694,7 +662,7 @@ Here's a breakdown of a `%perm` task:
694
662
695![perm diagram](https://media.urbit.org/docs/arvo/clay/perm-diagram.png)
663![perm diagram](https://media.urbit.org/docs/arvo/clay/perm-diagram.png)
696
664
697−## `%cred`
665+### `%cred`
698
666
699Here we'll look at creating a permission group by sending Clay a `%cred` `task`.
667Here we'll look at creating a permission group by sending Clay a `%cred` `task`.
700
668
@@ -706,7 +674,7 @@ Let's create a group called `'foo'` with a few ships:
706
674
707We'll check it with the next kind of `task`: [%crew](#crew).
675We'll check it with the next kind of `task`: [%crew](#crew).
708
676
709−## `%crew`
677+### `%crew`
710
678
711Here we'll look at retrieving permission groups by sending Clay a `%crew` `task` and receiving a `%cruz` `gift` in response.
679Here we'll look at retrieving permission groups by sending Clay a `%crew` `task` and receiving a `%cruz` `gift` in response.
712
680
@@ -717,7 +685,7 @@ Let's check, using the `send-task-take-gift.hoon` thread, for the permission gro
717[%cruz cez={[p=~.foo q={~nec ~bud ~wes ~zod ~sev}]}]
685[%cruz cez={[p=~.foo q={~nec ~bud ~wes ~zod ~sev}]}]
718```
686```
719
687
720−## `%crow`
688+### `%crow`
721
689
722Here we'll look at retrieving a list of all files and directories in all `desk`s which have permissions set for a group by sending Clay a `%crow` `task` and receiving a `%croz` `gift` in response.
690Here we'll look at retrieving a list of all files and directories in all `desk`s which have permissions set for a group by sending Clay a `%crow` `task` and receiving a `%croz` `gift` in response.
723
691
@@ -749,11 +717,11 @@ Now we'll use the `send-task-take-gift.hoon` thread to try `%crow`:
749]
717]
750```
718```
751
719
752−# Foreign Ships
720+## Foreign Ships
753
721
754See the [Foreign Ships](/docs/arvo/clay/tasks#foreign-ships) section of the [API Reference](/docs/arvo/clay/tasks) document for general details.
722See the [Foreign Ships](/docs/arvo/clay/tasks#foreign-ships) section of the [API Reference](/docs/arvo/clay/tasks) document for general details.
755
723
756−## `%warp` - Remote
724+### `%warp` - Remote
757
725
758Here we'll look at reading files on a foreign ship by sending Clay a `%warp` `task` with a foreign ship in the `wer` field and receiving a `%writ` `gift` in response.
726Here we'll look at reading files on a foreign ship by sending Clay a `%warp` `task` with a foreign ship in the `wer` field and receiving a `%writ` `gift` in response.
759
727
@@ -816,7 +784,7 @@ call: failed
816/sys/vane/clay/hoon:<[1.365 48].[1.365 50]>
784/sys/vane/clay/hoon:<[1.365 48].[1.365 50]>
817```
785```
818
786
819−## `%merg` - Remote
787+### `%merg` - Remote
820
788
821To merge a foreign `desk` into a local one, you just send Clay a `%merg` `task` (as you would for a local merge) and specify the foreign ship in the `her` field. For an example, see the [%merg](#merg) section.
789To merge a foreign `desk` into a local one, you just send Clay a `%merg` `task` (as you would for a local merge) and specify the foreign ship in the `her` field. For an example, see the [%merg](#merg) section.
822
790