Correction variables +ajout commentaire
This commit is contained in:
parent
fe0a982699
commit
160e0dd563
@ -1,18 +1,18 @@
|
|||||||
function global:Prompt {
|
function global:Prompt {
|
||||||
## Get the last item from the history
|
## Get the last item from the history
|
||||||
$historyItem = Get-History -Count 1
|
$historyItem = Get-History -Count 1
|
||||||
## If there were any history items
|
## If there were any history items
|
||||||
if()
|
if($historyItem)
|
||||||
{
|
{
|
||||||
# Save previous command details
|
# Save previous command details in this directory AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline
|
||||||
| convert-to-tsv | select -skip 1 >> ".command-history.txt"
|
$historyItem| convert-to-tsv | select -skip 1 >> ".command-history.txt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function global:convert-to-csv {
|
function global:convert-to-csv {
|
||||||
|
|
$input |
|
||||||
ConvertTo-Csv -delimiter " " -NoTypeInformation |
|
ConvertTo-Csv -delimiter " " -NoTypeInformation |
|
||||||
# First replace: Remove double-quotes 1) at beginning of line 2) at end of line 3) before a tab using regex look-ahead 4) after a tab using regex look-behind
|
# First replace: Remove double-quotes 1) at beginning of line 2) at end of line 3) before a tab using regex look-ahead 4) after a tab using regex look-behind
|
||||||
# Second replace: Replace 2 double-quotes with one (added by convert-to-csv)
|
# Second replace: Replace 2 double-quotes with one (added by convert-to-csv)
|
||||||
% { -replace '^"|"$|"(?=\t)|(?<=\t)"', '' -replace '""','"' }
|
% { -replace '^"|"$|"(?=\t)|(?<=\t)"', '' -replace '""','"' }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user