Skip to content

Commit d36fbb4

Browse files
committed
offset
1 parent d8b59a9 commit d36fbb4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Modules/Scripts/Get-HistoryEx.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ Begin
2323
{
2424
$script:id = 1
2525

26+
function MeasureHistory
27+
{
28+
# counts all lines so we can adjust the offset when only tailing
29+
$count = (Get-Content $savePath | Measure-Object).Count
30+
write-host "lines=$count"
31+
$script:id = $count - $last + 1
32+
}
33+
2634
function GetHistory
2735
{
2836
if ($last -gt 0 -and $match -ne $null)
@@ -53,7 +61,7 @@ Begin
5361
}
5462
Process
5563
{
56-
$script:last = 0
64+
$script:last = 40
5765
$script:match = $null
5866

5967
# because I'm too lazy to remember param names...
@@ -74,5 +82,6 @@ Process
7482

7583
$script:savePath = (Get-PSReadlineOption).HistorySavePath
7684

85+
MeasureHistory
7786
GetHistory
7887
}

0 commit comments

Comments
 (0)