unison/unison-src/transcripts/names.md

45 lines
1.1 KiB
Markdown
Raw Permalink Normal View History

2022-08-26 20:57:58 +03:00
# `names` command
2024-07-02 19:35:24 +03:00
```ucm
scratch/main> builtins.merge lib.builtins
```
2022-08-26 20:57:58 +03:00
Example uses of the `names` command and output
```unison
-- Some names with the same value
some.place.x = 1
some.otherplace.y = 1
some.otherplace.x = 10
somewhere.z = 1
-- Some similar name with a different value
somewhere.y = 2
```
2022-08-26 20:57:58 +03:00
```ucm
2024-07-02 19:35:24 +03:00
scratch/main> add
```
2022-08-26 20:57:58 +03:00
`names` searches relative to the current path.
```ucm
-- We can search by suffix and find all definitions named 'x', and each of their aliases respectively.
2024-07-02 19:35:24 +03:00
scratch/main> names x
2022-08-26 20:57:58 +03:00
-- We can search by hash, and see all aliases of that hash
2024-07-02 19:35:24 +03:00
scratch/main> names #gjmq673r1v
2024-07-10 20:54:15 +03:00
-- Works with absolute names too
2024-07-02 19:35:24 +03:00
scratch/main> names .some.place.x
2022-08-26 20:57:58 +03:00
```
2024-08-01 02:54:10 +03:00
`debug.names.global` searches from the root, and absolutely qualifies results
2022-08-26 20:57:58 +03:00
2024-08-01 02:54:10 +03:00
```ucm
2024-07-02 19:35:24 +03:00
-- We can search from a different branch and find all names in the codebase named 'x', and each of their aliases respectively.
2024-08-01 02:54:10 +03:00
scratch/other> debug.names.global x
2022-08-26 20:57:58 +03:00
-- We can search by hash, and see all aliases of that hash in the codebase
2024-08-01 02:54:10 +03:00
scratch/other> debug.names.global #gjmq673r1v
2022-08-26 20:57:58 +03:00
-- We can search using an absolute name
2024-08-01 02:54:10 +03:00
scratch/other> debug.names.global .some.place.x
2022-08-26 20:57:58 +03:00
```