2019-11-08 00:53:24 +03:00
|
|
|
# Using numbered arguments in UCM
|
|
|
|
|
|
|
|
First lets add some contents to our codebase.
|
|
|
|
|
2024-07-10 17:46:18 +03:00
|
|
|
``` unison
|
2019-11-08 00:53:24 +03:00
|
|
|
foo = "foo"
|
|
|
|
bar = "bar"
|
|
|
|
baz = "baz"
|
|
|
|
qux = "qux"
|
|
|
|
quux = "quux"
|
|
|
|
corge = "corge"
|
|
|
|
```
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2019-11-08 00:53:24 +03:00
|
|
|
|
2023-12-22 14:55:24 +03:00
|
|
|
Loading changes detected in scratch.u.
|
|
|
|
|
2019-11-08 00:53:24 +03:00
|
|
|
I found and typechecked these definitions in scratch.u. If you
|
|
|
|
do an `add` or `update`, here's how your codebase would
|
|
|
|
change:
|
|
|
|
|
|
|
|
⍟ These new definitions are ok to `add`:
|
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
bar : Text
|
|
|
|
baz : Text
|
|
|
|
corge : Text
|
|
|
|
foo : Text
|
|
|
|
quux : Text
|
|
|
|
qux : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
|
|
|
|
```
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-26 21:48:47 +03:00
|
|
|
scratch/main> add
|
2019-11-08 00:53:24 +03:00
|
|
|
|
|
|
|
⍟ I've added these definitions:
|
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
bar : Text
|
|
|
|
baz : Text
|
|
|
|
corge : Text
|
|
|
|
foo : Text
|
|
|
|
quux : Text
|
|
|
|
qux : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
|
|
|
|
```
|
|
|
|
We can get the list of things in the namespace, and UCM will give us a numbered
|
|
|
|
list:
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-26 21:48:47 +03:00
|
|
|
scratch/main> find
|
2019-11-08 00:53:24 +03:00
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
1. bar : Text
|
|
|
|
2. baz : Text
|
|
|
|
3. corge : Text
|
|
|
|
4. foo : Text
|
|
|
|
5. quux : Text
|
|
|
|
6. qux : Text
|
2024-01-12 20:39:18 +03:00
|
|
|
7. builtin type Text
|
2019-11-08 00:53:24 +03:00
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
We can ask to `view` the second element of this list:
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-26 21:48:47 +03:00
|
|
|
scratch/main> find
|
2019-11-08 00:53:24 +03:00
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
1. bar : Text
|
|
|
|
2. baz : Text
|
|
|
|
3. corge : Text
|
|
|
|
4. foo : Text
|
|
|
|
5. quux : Text
|
|
|
|
6. qux : Text
|
2024-01-12 20:39:18 +03:00
|
|
|
7. builtin type Text
|
2019-11-08 00:53:24 +03:00
|
|
|
|
|
|
|
|
2024-06-26 21:48:47 +03:00
|
|
|
scratch/main> view 2
|
2019-11-08 00:53:24 +03:00
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
baz : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
baz = "baz"
|
|
|
|
|
|
|
|
```
|
|
|
|
And we can `view` multiple elements by separating with spaces:
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-26 21:48:47 +03:00
|
|
|
scratch/main> find
|
2019-11-08 00:53:24 +03:00
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
1. bar : Text
|
|
|
|
2. baz : Text
|
|
|
|
3. corge : Text
|
|
|
|
4. foo : Text
|
|
|
|
5. quux : Text
|
|
|
|
6. qux : Text
|
2024-01-12 20:39:18 +03:00
|
|
|
7. builtin type Text
|
2019-11-08 00:53:24 +03:00
|
|
|
|
|
|
|
|
2024-06-26 21:48:47 +03:00
|
|
|
scratch/main> view 2 3 5
|
2019-11-08 00:53:24 +03:00
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
baz : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
baz = "baz"
|
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
corge : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
corge = "corge"
|
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
quux : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
quux = "quux"
|
|
|
|
|
|
|
|
```
|
|
|
|
We can also ask for a range:
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-26 21:48:47 +03:00
|
|
|
scratch/main> find
|
2019-11-08 00:53:24 +03:00
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
1. bar : Text
|
|
|
|
2. baz : Text
|
|
|
|
3. corge : Text
|
|
|
|
4. foo : Text
|
|
|
|
5. quux : Text
|
|
|
|
6. qux : Text
|
2024-01-12 20:39:18 +03:00
|
|
|
7. builtin type Text
|
2019-11-08 00:53:24 +03:00
|
|
|
|
|
|
|
|
2024-06-26 21:48:47 +03:00
|
|
|
scratch/main> view 2-4
|
2019-11-08 00:53:24 +03:00
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
baz : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
baz = "baz"
|
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
corge : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
corge = "corge"
|
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
foo : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
foo = "foo"
|
|
|
|
|
|
|
|
```
|
|
|
|
And we can ask for multiple ranges and use mix of ranges and numbers:
|
|
|
|
|
2024-07-10 19:17:15 +03:00
|
|
|
``` ucm
|
2024-06-26 21:48:47 +03:00
|
|
|
scratch/main> find
|
2019-11-08 00:53:24 +03:00
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
1. bar : Text
|
|
|
|
2. baz : Text
|
|
|
|
3. corge : Text
|
|
|
|
4. foo : Text
|
|
|
|
5. quux : Text
|
|
|
|
6. qux : Text
|
2024-01-12 20:39:18 +03:00
|
|
|
7. builtin type Text
|
2019-11-08 00:53:24 +03:00
|
|
|
|
|
|
|
|
2024-06-26 21:48:47 +03:00
|
|
|
scratch/main> view 1-3 4 5-6
|
2019-11-08 00:53:24 +03:00
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
bar : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
bar = "bar"
|
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
baz : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
baz = "baz"
|
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
corge : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
corge = "corge"
|
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
foo : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
foo = "foo"
|
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
quux : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
quux = "quux"
|
|
|
|
|
2019-11-14 00:57:51 +03:00
|
|
|
qux : Text
|
2019-11-08 00:53:24 +03:00
|
|
|
qux = "qux"
|
|
|
|
|
|
|
|
```
|