Formats/Formats/HistoryInfo.formats.ps1xml
<?xml version="1.0" encoding="utf-8" ?> <Configuration> <ViewDefinitions> <View> <Name>history</Name> <ViewSelectedBy> <TypeName>Microsoft.PowerShell.Commands.HistoryInfo</TypeName> </ViewSelectedBy> <TableControl> <TableHeaders> <TableColumnHeader> <Width>4</Width> <Alignment>Right</Alignment> </TableColumnHeader> <TableColumnHeader> <Label>Duration</Label> <Width>11</Width> <Alignment>Right</Alignment> </TableColumnHeader> <TableColumnHeader> <Label>CommandLine</Label> </TableColumnHeader> </TableHeaders> <TableRowEntries> <TableRowEntry> <TableColumnItems> <TableColumnItem> <PropertyName>Id</PropertyName> </TableColumnItem> <TableColumnItem> <ScriptBlock> $ts = $_.EndExecutionTime - $_.StartExecutionTime if($ts.Minutes) { if($ts.Hours) { if($ts.Days) { return "{0:##}d {1:00}h {2:00}m" -f $ts.Days, $ts.Hours, $ts.Minutes } return "{0:##}h {1:00}m {2:00}s" -f $ts.Hours, $ts.Minutes, $ts.Seconds } return "{0:##}m {1:n3}s" -f $ts.Minutes, ($ts.TotalSeconds - ($ts.Minutes * 60)) } return "{0:n5}s" -f $ts.TotalSeconds </ScriptBlock> </TableColumnItem> <TableColumnItem> <ScriptBlock> $_.CommandLine.TrimStart() -replace "[\r\n]+", "$([char]0x2026) " </ScriptBlock> </TableColumnItem> </TableColumnItems> </TableRowEntry> </TableRowEntries> </TableControl> </View> </ViewDefinitions> </Configuration> |