-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for custom clipboard commands
- Loading branch information
1 parent
cf90a0a
commit 9e263f3
Showing
8 changed files
with
194 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<!-- | ||
GENERATED FILE - DO NOT EDIT | ||
This file was generated by [MarkdownSnippets](https://github.com/SimonCropp/MarkdownSnippets). | ||
Source File: /docs/mdsource/clipboard.source.md | ||
To change this file edit the source file and then run MarkdownSnippets. | ||
--> | ||
|
||
# Clipboard | ||
|
||
Verify makes use of the clipboard. | ||
|
||
This is done via the [TextCopy project](https://github.com/CopyText/TextCopy). | ||
|
||
|
||
## Accept received | ||
|
||
When a verification fails, a command to accept the received version is added to the clipboard: | ||
|
||
On Windows: | ||
|
||
> cmd /c move /Y "ReceivedFile" "VerifiedFile" | ||
On Linux or OS: | ||
|
||
> mv -f "ReceivedFile" "VerifiedFile" | ||
|
||
## Cleanup dangling converter files | ||
|
||
When a the number of files outputted from a [converter](converter.mc) reduces, a command to delete the extra files is added to the clipboard: | ||
|
||
On Windows: | ||
|
||
> cmd /c del "VerifiedFile" | ||
On Linux or OS: | ||
|
||
> rm -f "VerifiedFile" | ||
|
||
## Custom Command | ||
|
||
A custom command can be used by adding environment variables. | ||
|
||
|
||
### Accept | ||
|
||
Add a variable named `Verify.MoveCommand` where `{0}` and `{1}` will be replaced with the received and verified files respectively. | ||
|
||
|
||
### Cleanup | ||
|
||
Add a variable named `Verify.DeleteCommand` where `{0}` will be replaced with the file to be cleaned up. | ||
|
||
|
||
## Disable Clipboard | ||
|
||
The clipboard behavior can be disable using the following: | ||
|
||
|
||
### Per Test | ||
|
||
<!-- snippet: DisableClipboard --> | ||
<a id='snippet-disableclipboard'/></a> | ||
```cs | ||
var settings = new VerifySettings(); | ||
settings.DisableClipboard(); | ||
``` | ||
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L38-L43' title='File snippet `disableclipboard` was extracted from'>snippet source</a> | <a href='#snippet-disableclipboard' title='Navigate to start of snippet `disableclipboard`'>anchor</a></sup> | ||
<!-- endsnippet --> | ||
|
||
|
||
### For all tests | ||
|
||
<!-- snippet: DisableClipboardGlobal --> | ||
<a id='snippet-disableclipboardglobal'/></a> | ||
```cs | ||
SharedVerifySettings.DisableClipboard(); | ||
``` | ||
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L58-L62' title='File snippet `disableclipboardglobal` was extracted from'>snippet source</a> | <a href='#snippet-disableclipboardglobal' title='Navigate to start of snippet `disableclipboardglobal`'>anchor</a></sup> | ||
<!-- endsnippet --> | ||
|
||
If clipboard is disabled for all tests, it can be re-enabled at the test level: | ||
|
||
<!-- snippet: EnableClipboard --> | ||
<a id='snippet-enableclipboard'/></a> | ||
```cs | ||
var settings = new VerifySettings(); | ||
settings.EnableClipboard(); | ||
``` | ||
<sup><a href='/src/Verify.Tests/Snippets/Snippets.cs#L48-L53' title='File snippet `enableclipboard` was extracted from'>snippet source</a> | <a href='#snippet-enableclipboard' title='Navigate to start of snippet `enableclipboard`'>anchor</a></sup> | ||
<!-- endsnippet --> | ||
|
||
|
||
### For a machine | ||
|
||
Set a `Verify.DisableClipboard` environment variable to `true`. This overrides the above settings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Clipboard | ||
|
||
Verify makes use of the clipboard. | ||
|
||
This is done via the [TextCopy project](https://github.com/CopyText/TextCopy). | ||
|
||
|
||
## Accept received | ||
|
||
When a verification fails, a command to accept the received version is added to the clipboard: | ||
|
||
On Windows: | ||
|
||
> cmd /c move /Y "ReceivedFile" "VerifiedFile" | ||
On Linux or OS: | ||
|
||
> mv -f "ReceivedFile" "VerifiedFile" | ||
|
||
## Cleanup dangling converter files | ||
|
||
When a the number of files outputted from a [converter](converter.mc) reduces, a command to delete the extra files is added to the clipboard: | ||
|
||
On Windows: | ||
|
||
> cmd /c del "VerifiedFile" | ||
On Linux or OS: | ||
|
||
> rm -f "VerifiedFile" | ||
|
||
## Custom Command | ||
|
||
A custom command can be used by adding environment variables. | ||
|
||
|
||
### Accept | ||
|
||
Add a variable named `Verify.MoveCommand` where `{0}` and `{1}` will be replaced with the received and verified files respectively. | ||
|
||
|
||
### Cleanup | ||
|
||
Add a variable named `Verify.DeleteCommand` where `{0}` will be replaced with the file to be cleaned up. | ||
|
||
|
||
## Disable Clipboard | ||
|
||
The clipboard behavior can be disable using the following: | ||
|
||
|
||
### Per Test | ||
|
||
snippet: DisableClipboard | ||
|
||
|
||
### For all tests | ||
|
||
snippet: DisableClipboardGlobal | ||
|
||
If clipboard is disabled for all tests, it can be re-enabled at the test level: | ||
|
||
snippet: EnableClipboard | ||
|
||
|
||
### For a machine | ||
|
||
Set a `Verify.DisableClipboard` environment variable to `true`. This overrides the above settings. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters