mirror of
https://github.com/unisonweb/unison.git
synced 2024-10-04 21:57:25 +03:00
Merge pull request #840 from pt2121/pt/FindPatchI-LoopState-numberedArgs
Add FindPatchI outputs to LoopState's numberedArgs
This commit is contained in:
commit
383f8d2570
@ -26,3 +26,4 @@ The format for this list: name, GitHub handle, and then optional blurb about wha
|
||||
* Ian Jeffries (@seagreen)
|
||||
* Silvino Escalona (@sunrisem)
|
||||
* James Sully (@sullyj3)
|
||||
* Prat Tana (@pt2121)
|
||||
|
@ -825,12 +825,13 @@ loop = do
|
||||
-- next update for that file (which will happen immediately)
|
||||
latestFile .= ((, True) <$> loc)
|
||||
|
||||
FindPatchI ->
|
||||
let patches = Set.fromList
|
||||
FindPatchI -> do
|
||||
let patches =
|
||||
[ Path.toName $ Path.snoc p seg
|
||||
| (p, b) <- Branch.toList0 currentBranch0
|
||||
, (seg, _) <- Map.toList (Branch._edits b) ]
|
||||
in respond $ ListOfPatches patches
|
||||
respond $ ListOfPatches $ Set.fromList patches
|
||||
numberedArgs .= fmap Name.toString patches
|
||||
|
||||
FindShallowI pathArg -> do
|
||||
prettyPrintNames0 <- basicPrettyPrintNames0
|
||||
|
@ -523,9 +523,15 @@ notifyUser dir o = case o of
|
||||
, "You're missing:" `P.hang` P.lines (fmap (P.text . Reference.toText) new)
|
||||
, "I'm missing:" `P.hang` P.lines (fmap (P.text . Reference.toText) old)
|
||||
]
|
||||
ListOfPatches patches ->
|
||||
-- todo: make this prettier
|
||||
pure . P.lines . fmap prettyName $ toList patches
|
||||
ListOfPatches patches -> pure $
|
||||
if null patches then P.lit "nothing to show"
|
||||
else numberedPatches patches
|
||||
where
|
||||
numberedPatches :: Set Name -> P.Pretty P.ColorText
|
||||
numberedPatches patches =
|
||||
(P.column2 . fmap format) ([(1::Integer)..] `zip` (toList patches))
|
||||
where
|
||||
format (i, p) = (P.hiBlack . fromString $ show i <> ".", prettyName p)
|
||||
NoConfiguredGitUrl pp p ->
|
||||
pure . P.fatalCallout . P.wrap $
|
||||
"I don't know where to " <>
|
||||
|
24
unison-src/transcripts/find-patch.md
Normal file
24
unison-src/transcripts/find-patch.md
Normal file
@ -0,0 +1,24 @@
|
||||
# find.patch Test
|
||||
|
||||
```unison test.u
|
||||
hey = "yello"
|
||||
```
|
||||
|
||||
```ucm
|
||||
.> add
|
||||
```
|
||||
|
||||
Update
|
||||
|
||||
```unison test.u
|
||||
hey = "hello"
|
||||
```
|
||||
|
||||
Update
|
||||
|
||||
```ucm
|
||||
.> update
|
||||
.> find.patch
|
||||
.> view.patch patch
|
||||
.> view.patch 1
|
||||
```
|
83
unison-src/transcripts/find-patch.output.md
Normal file
83
unison-src/transcripts/find-patch.output.md
Normal file
@ -0,0 +1,83 @@
|
||||
# find.patch Test
|
||||
|
||||
```unison
|
||||
---
|
||||
title: test.u
|
||||
---
|
||||
hey = "yello"
|
||||
|
||||
```
|
||||
|
||||
|
||||
```ucm
|
||||
|
||||
I found and typechecked these definitions in test.u. If you do
|
||||
an `add` or `update`, here's how your codebase would change:
|
||||
|
||||
⍟ These new definitions are ok to `add`:
|
||||
|
||||
hey : builtin.Text
|
||||
|
||||
Now evaluating any watch expressions (lines starting with
|
||||
`>`)... Ctrl+C cancels.
|
||||
|
||||
```
|
||||
```ucm
|
||||
.> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
hey : builtin.Text
|
||||
|
||||
```
|
||||
Update
|
||||
|
||||
```unison
|
||||
---
|
||||
title: test.u
|
||||
---
|
||||
hey = "hello"
|
||||
|
||||
```
|
||||
|
||||
|
||||
```ucm
|
||||
|
||||
I found and typechecked these definitions in test.u. If you do
|
||||
an `add` or `update`, here's how your codebase would change:
|
||||
|
||||
⍟ These new definitions will replace existing ones of the
|
||||
same name and are ok to `update`:
|
||||
|
||||
hey : builtin.Text
|
||||
|
||||
Now evaluating any watch expressions (lines starting with
|
||||
`>`)... Ctrl+C cancels.
|
||||
|
||||
```
|
||||
Update
|
||||
|
||||
```ucm
|
||||
.> update
|
||||
|
||||
⍟ I've updated to these definitions:
|
||||
|
||||
hey : builtin.Text
|
||||
|
||||
✅
|
||||
|
||||
No conflicts or edits in progress.
|
||||
|
||||
.> find.patch
|
||||
|
||||
1. patch
|
||||
|
||||
.> view.patch patch
|
||||
|
||||
Edited Terms: hey#8e79ctircj -> hey
|
||||
|
||||
.> view.patch 1
|
||||
|
||||
Edited Terms: hey#8e79ctircj -> hey
|
||||
|
||||
```
|
Loading…
Reference in New Issue
Block a user