Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

### Changed

- The `Show-PesterResult` List panel now the files using relative path from the
current directory. It also added padding on the selected item as well as an
additional icon to show the highlight.

### Fixed

- Removed extra item from the stack that tracked which layer of the view you
were in.


## [0.1.0] Initial Version

### Added
Expand Down
38 changes: 33 additions & 5 deletions PesterExplorer/Private/Get-ListPanel.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,40 @@ function Get-ListPanel {
[string]
$SelectedItem
)
$resultList = $List | ForEach-Object {
$unselectedStyle = @{
RootColor = [Spectre.Console.Color]::Grey
SeparatorColor = [Spectre.Console.Color]::Grey
StemColor = [Spectre.Console.Color]::Grey
LeafColor = [Spectre.Console.Color]::White
}
$results = $List | ForEach-Object {
$name = $_
if ($name -eq $SelectedItem) {
$name = "[Turquoise2]$($name)[/]"
if($name -eq '..') {
# This is a parent item, so we show it as a folder
if ($name -eq $SelectedItem) {
Write-SpectreHost ":up_arrow: [Turquoise2]$name[/]" -PassThru | Format-SpectrePadded -Padding 1
} else {
Write-SpectreHost "$name" -PassThru | Format-SpectrePadded -Padding 0
}
}
elseif(Test-Path $name){
$relativePath = [System.IO.Path]::GetRelativePath(
(Get-Location).Path,
$name
)
if ($name -eq $SelectedItem) {
Format-SpectreTextPath -Path $relativePath | Format-SpectrePadded -Padding 1
} else {
Format-SpectreTextPath -Path $relativePath -PathStyle $unselectedStyle | Format-SpectrePadded -Padding 0
}
}
else {
if ($name -eq $SelectedItem) {
Write-SpectreHost ":right_arrow: [Turquoise2]$name[/]" -PassThru | Format-SpectrePadded -Padding 1
} else {
Write-SpectreHost $name -PassThru | Format-SpectrePadded -Padding 0
}
}
return $name
}
return $resultList | Format-SpectreRows | Format-SpectrePanel -Header "[white]List[/]" -Expand
$results | Format-SpectreRows | Format-SpectrePanel -Header "[white]List[/]" -Expand
}
9 changes: 5 additions & 4 deletions PesterExplorer/Public/Show-PesterResult.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ function Show-PesterResult {
$selectedItem = $list[0]
$stack = [System.Collections.Stack]::new()
$object = $PesterResult
$stack.Push($object)
#endregion Initial State

while ($true) {
Expand All @@ -90,17 +89,19 @@ function Show-PesterResult {
$selectedItem = $list[($list.IndexOf($selectedItem) - 1 + $list.Count) % $list.Count]
} elseif ($lastKeyPressed.Key -eq "Enter") {
<# Recurse into Pester Object #>
if($items.Item($selectedItem).GetType().Name -eq "Test") {
# This is a test. We don't want to go deeper.
}
if($selectedItem -like '*..*') {
# Move up one via selecting ..
$object = $stack.Pop()
Write-Debug "Popped item from stack: $($object.Name)"
} else {
Write-Debug "Pushing item into stack: $($items.Item($selectedItem).Name)"

$stack.Push($object)
$object = $items.Item($selectedItem)
if($object.GetType().Name -eq "Test") {
# This is a test. We don't want to go deeper.
$object = $stack.Pop()
}
}
$items = Get-ListFromObject -Object $object
$list = [array]$items.Keys
Expand Down
Loading