Verify.Cli
1.0.380
Prefix Reserved
See the version list below for details.
dotnet tool install --global Verify.Cli --version 1.0.380
dotnet new tool-manifest
dotnet tool install --local Verify.Cli --version 1.0.380
#tool dotnet:?package=Verify.Cli&version=1.0.380
nuke :add-package Verify.Cli --version 1.0.380
Verify.Cli
A command-line tool that uses the Verify library for regular files (without requiring you to create a unit test project).
Installation
Install as .NET global tool
dotnet tool install -g Verify.Cli
Once installed, invoke directly via the verify
command.
Usage
If you run this tool interactively, then you'll get a similar experience that you would using VerifyTests in a .NET unit test project. Verify.Cli will utilise any existing compatible file diff tool to display the diff.
verify --file <path to file to verify> [--verified-dir <directory>]
The first time you use Verify.Cli, it will output the contents of the file.
Options
--file
or-f
: The file to verify (required)--verified-dir
or-d
: Directory to store/look for .verified files (optional)--scrub-inline-datetime
: Format for inline date times to scrub, e.g., 'yyyy-MM-ddTHH:mm:ss.fffZ' (optional)
Examples
Basic usage:
verify --file C:\tmp\example.txt
With custom verified files directory:
verify --file C:\tmp\example.txt --verified-dir C:\MyVerifiedFiles
This will look for the verified file at C:\MyVerifiedFiles\example.txt.verified.txt
instead of the default location next to the source file.
With date time scrubbing:
verify --file C:\tmp\log.txt --scrub-inline-datetime "yyyy-MM-ddTHH:mm:ss.fffZ"
This will scrub inline date times matching the specified format from the file content before verification.
You can combine options:
verify --file C:\tmp\log.txt --verified-dir C:\MyVerifiedFiles --scrub-inline-datetime "yyyy-MM-dd HH:mm:ss"
When the files match, the tool exits with code 0 and produces no output.
Unhandled exception: VerifyException: Directory: C:\tmp
New:
- Received: example.txt.received.txt
Verified: example.txt.verified.txt
FileContent:
New:
Received: example.txt.received.txt
This is
a text file.
Your diff tool of choice (if found by the Verify's DiffEngine library) can then be used to compare to the verified file (if it exists), or create it (if the first time).
If the verified file matches the received file, then there is no output (and the exit code is zero).
If the received file is different from the verified file, then a diff will be shown in the console, a non-zero exit code will be returned, and if in an interactive environment with a supported diff tool, then that tool will be launched.
Unhandled exception: VerifyException: Directory: C:\tmp
NotEqual:
- Received: example.txt.received.txt
Verified: example.txt.verified.txt
FileContent:
NotEqual:
Received: example.txt.received.txt
This is
an updated text file.
Verified: example.txt.verified.txt
This is
a text file.
Example with Beyond Compare launched:
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.