-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
734 additions
and
0 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,121 @@ | ||
--- | ||
external help file: Microsoft.PowerShell.TextUtility.dll-Help.xml | ||
Module Name: Microsoft.PowerShell.TextUtility | ||
online version: | ||
ms.date: 08/29/2024 | ||
schema: 2.0.0 | ||
--- | ||
|
||
# Compare-Text | ||
|
||
## SYNOPSIS | ||
|
||
This cmdlet compares two text strings using diff-match-patch. | ||
|
||
## SYNTAX | ||
|
||
``` | ||
Compare-Text [-LeftText] <String> [-RightText] <String> [-View <CompareTextView>] | ||
[<CommonParameters>] | ||
``` | ||
|
||
## DESCRIPTION | ||
|
||
This cmdlet compares two text strings using the **diff-match-patch** library. | ||
|
||
The [diff-match-patch](https://github.com/google/diff-match-patch) library provides methods used for | ||
synchronizing plain text, similar to the diff functions of `git`. | ||
|
||
## EXAMPLES | ||
|
||
### Example 1 - Compare two multiline strings | ||
|
||
This example shows how to compare two multiline strings using the `Compare-Text` cmdlet. The cmdlet | ||
uses ANSI escape codes to highlight the differences between the two strings. | ||
|
||
```powershell | ||
$leftText = @("This is some", "example text.") -join [Environment]::NewLine | ||
$rightText = @(" This is other", "example text used!") -join [Environment]::NewLine | ||
Compare-Text -LeftText $leftText -RightText $rightText -View SideBySide | ||
``` | ||
|
||
```Output | ||
1 | This is some | This is other | ||
2 | example text. | example text… | ||
``` | ||
|
||
This example output shows the differences in red with strikethrough characters on the left and | ||
additions in green on the right. | ||
|
||
## PARAMETERS | ||
|
||
### -LeftText | ||
|
||
The source string to be compared. This can be a single line or a multiline string. | ||
|
||
```yaml | ||
Type: System.String | ||
Parameter Sets: (All) | ||
Aliases: | ||
|
||
Required: True | ||
Position: 0 | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
### -RightText | ||
The difference string to be compared. This can be a single line or a multiline string. | ||
```yaml | ||
Type: System.String | ||
Parameter Sets: (All) | ||
Aliases: | ||
|
||
Required: True | ||
Position: 1 | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
### -View | ||
The view mode to display the comparison. The possible values are: | ||
- `Inline` - (Default) Shows the differences, side-by-side on the same line. | ||
- `SideBySide` - Shows the differences, side-by-side in separate columns. | ||
|
||
```yaml | ||
Type: Microsoft.PowerShell.TextUtility.CompareTextView | ||
Parameter Sets: (All) | ||
Aliases: | ||
Accepted values: Inline, SideBySide | ||
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
|
||
### CommonParameters | ||
|
||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, | ||
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, | ||
-WarningAction, and -WarningVariable. For more information, see | ||
[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). | ||
|
||
## INPUTS | ||
|
||
### None | ||
|
||
## OUTPUTS | ||
|
||
### Microsoft.PowerShell.TextUtility.CompareTextDiff | ||
|
||
## NOTES | ||
|
||
## RELATED LINKS |
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,120 @@ | ||
--- | ||
external help file: Microsoft.PowerShell.TextUtility.dll-Help.xml | ||
Module Name: Microsoft.PowerShell.TextUtility | ||
online version: | ||
ms.date: 08/29/2024 | ||
schema: 2.0.0 | ||
--- | ||
|
||
# ConvertFrom-Base64 | ||
|
||
## SYNOPSIS | ||
|
||
Converts a Base64-encoded string back to its original form. | ||
|
||
## SYNTAX | ||
|
||
``` | ||
ConvertFrom-Base64 [-EncodedText] <String> [-AsByteArray] [<CommonParameters>] | ||
``` | ||
|
||
## DESCRIPTION | ||
|
||
The command converts a Base64-encoded string back to its original form. The original form can be a | ||
string or any arbitrary binary data. | ||
|
||
## EXAMPLES | ||
|
||
### Example 1 - Convert a Base64-encoded string to its original form | ||
|
||
```powershell | ||
ConvertFrom-Base64 -EncodedText "SGVsbG8gV29ybGQh" | ||
``` | ||
|
||
```output | ||
Hello World! | ||
``` | ||
|
||
### Example 1 - Convert a Base64-encoded string to its original form as a byte array | ||
|
||
```powershell | ||
ConvertFrom-Base64 -EncodedText "SGVsbG8gV29ybGQh" -AsByteArray | ||
``` | ||
|
||
```output | ||
72 | ||
101 | ||
108 | ||
108 | ||
111 | ||
32 | ||
87 | ||
111 | ||
114 | ||
108 | ||
100 | ||
33 | ||
``` | ||
|
||
## PARAMETERS | ||
|
||
### -AsByteArray | ||
|
||
Returns the converted output as an array of bytes. This is useful when the original form is binary | ||
data. | ||
|
||
```yaml | ||
Type: System.Management.Automation.SwitchParameter | ||
Parameter Sets: (All) | ||
Aliases: | ||
|
||
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
### -EncodedText | ||
The Base64-encoded string to convert back to its original form. | ||
```yaml | ||
Type: System.String | ||
Parameter Sets: (All) | ||
Aliases: | ||
|
||
Required: True | ||
Position: 0 | ||
Default value: None | ||
Accept pipeline input: True (ByValue) | ||
Accept wildcard characters: False | ||
``` | ||
### CommonParameters | ||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, | ||
-InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, | ||
-WarningAction, and -WarningVariable. For more information, see | ||
[about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). | ||
## INPUTS | ||
### System.String | ||
## OUTPUTS | ||
### System.String | ||
By default, this command returns the converted data as a string. | ||
### System.Byte | ||
When you use the **AsByteArray** parameter, this command returns the converted data as an array of | ||
bytes. | ||
## NOTES | ||
## RELATED LINKS | ||
[ConvertTo-Base64](ConvertTo-Base64.md) |
Oops, something went wrong.