OS
New feature description
I, unfortunately, have some very long run-on one-lines because I was using PSFzf before and it didn't handle multi-line commands.
I was reading through the below code. Would there be a way to set up a config for maxNameLength so it would just wrap the text around? Maybe have some "wrap character".
|
$historySet = [System.Collections.Generic.Hashset[string]]::new([System.StringComparer]::OrdinalIgnoreCase) |
|
$entries = [System.Collections.Generic.List[PowerShellRun.SelectorEntry]]::new() |
|
$maxNameLength = 128 |
|
foreach ($item in $historyItems) { |
|
$isAdded = $historySet.Add($item.CommandLine) |
|
if ($isAdded) { |
|
$entry = [PowerShellRun.SelectorEntry]::new() |
|
$entry.UserData = $item |
|
$entry.Name = if ($item.CommandLine.Length -gt $maxNameLength) { |
|
$item.CommandLine.Substring(0, $maxNameLength) |
|
} else { |
|
$item.CommandLine |
|
} |
|
|
|
$startTime = if ($item.StartTime -ne [DateTime]::MinValue) { |
|
$localTime = $item.StartTime.ToLocalTime() |
|
'{0} {1}' -f $localTime.ToShortDateString(), $localTime.ToShortTimeString() |
|
} else { |
|
'-' |
|
} |
|
$elapsedTime = if ($item.ApproximateElapsedTime -ne [TimeSpan]::Zero) { |
|
$item.ApproximateElapsedTime.ToString() |
|
} else { |
|
'-' |
|
} |
|
|
|
$entry.Preview = "{0}📅 {1} ⌚ {2}{3}`n`n{4}" -f $PSStyle.Underline, $startTime, $elapsedTime, $PSStyle.UnderlineOff, $item.CommandLine |
|
$entry.ActionKeys = $actionKeys |
|
|
|
$entries.Add($entry) |
|
} |
|
} |
I tend to store code that should be a function{} in my history for later use and editing. Bad habit, sure. Just was thinking. I'm fully off PSFzf now. Thanks for putting this together. Lots of work and thought surely! :-)
NOTE 1: Well in thinking about it more, maybe I should just rewrite my own hehe...
OS
New feature description
I, unfortunately, have some very long run-on one-lines because I was using
PSFzfbefore and it didn't handle multi-line commands.I was reading through the below code. Would there be a way to set up a config for
maxNameLengthso it would just wrap the text around? Maybe have some "wrap character".PowerShellRun/module/PowerShellRun/Private/PSReadLineHistory.ps1
Lines 17 to 48 in a948791
I tend to store
codethat should be afunction{}in my history for later use and editing. Bad habit, sure. Just was thinking. I'm fully offPSFzfnow. Thanks for putting this together. Lots of work and thought surely! :-)NOTE 1: Well in thinking about it more, maybe I should just rewrite my own hehe...