@@ -44,17 +44,16 @@ function Invoke-PassFind {
44
44
[CmdletBinding ()]
45
45
param (
46
46
[Parameter (Mandatory , Position = 0 )]
47
- [string ]$PassName
47
+ [string ]$Pattern
48
48
)
49
49
$PassStorePath = Get-PasswordStore
50
- $LeafPath = Split-Path - Leaf $PassName
51
50
$LikeOptions = @ {
52
51
Recurse = $true
53
52
}
54
53
55
54
$Like = (Get-ChildItem - Path $PassStorePath @ExcludeGit |
56
55
Get-ChildItem @LikeOptions |
57
- Where-Object { $_.FullName | Select-String - Pattern $LeafPath } |
56
+ Where-Object { $_.FullName | Select-String - Pattern $Pattern } |
58
57
ForEach-Object { Get-PassName $_ $PassStorePath })
59
58
return $Like
60
59
}
@@ -78,7 +77,7 @@ function Invoke-PassGenerate {
78
77
)
79
78
$PassPath = Get-RealPath $PassName - MakeParentDirectoy $true
80
79
if ((Test-Path $PassPath ) -and (-not $Force )) {
81
- $Confirmation = Read-Host " An entry already exists for $RelativePath . Overwrite it? [y/N] "
80
+ $Confirmation = Read-Host " An entry already exists for $PassName . Overwrite it? [y/N] "
82
81
if ($Confirmation -ne ' y' ) {
83
82
throw ' User interrupted.'
84
83
}
@@ -408,6 +407,7 @@ function Out-TreeInternal {
408
407
Param (
409
408
[System.IO.FileSystemInfo ] $Info ,
410
409
[int ] $Depth ,
410
+ [string ] $Format ,
411
411
[switch ] $Last
412
412
)
413
413
if (-not $Info ) {
@@ -417,36 +417,37 @@ function Out-TreeInternal {
417
417
Write-Debug $Info
418
418
419
419
if ($Depth -eq 0 ) {
420
- $Format = ' {0}'
420
+ $DisplayFormat = ' {0}'
421
421
}
422
422
else {
423
423
$CurrentLeafFormat = if ($Last ) { $LastLeafFormat } else { $LeafFormat }
424
- $Format = $TrunkFormat * ($Depth - 1 ) + $CurrentLeafFormat + ' {0}'
424
+ $DisplayFormat = $Format + $CurrentLeafFormat + ' {0}'
425
+ $CurrentTrunkFormat = if ($Last ) { " " } else { " | " }
426
+ $Format = $Format + $CurrentTrunkFormat
427
+
425
428
}
426
429
427
430
$KeyName = if ($Info.Name -match ' (?<path>.*).gpg' ) { $Matches [' path' ] } else { $Info.Name }
428
431
if (-not ($KeyName -like ' .*' )) {
429
432
Write-Debug $KeyName
430
- Write-Output ($Format -f $KeyName )
433
+ Write-Output ($DisplayFormat -f $KeyName )
431
434
}
432
435
433
436
If (Test-Path - Path $Info.FullName - PathType Container) {
434
- $Children = (Get-ChildItem @ExcludeGit $Info.FullName )
435
- if ($Children -is [ object []] ) {
436
- switch ( $Children .Length ) {
437
- 0 { return ; }
438
- 1 { Out-TreeInternal - Info $Children [0 ] - Depth ($Depth + 1 ) - Last }
439
- Default {
440
- foreach ( $child in $Children [ 0 .. ( $Children .Length - 2 )]) {
441
- Out-TreeInternal - Info $child - Depth ( $Depth + 1 )
442
- }
443
- Out-TreeInternal - Info $Children [ $Children .Length - 1 ] - Depth ($Depth + 1 ) - Last
437
+ $Children = @ (Get-ChildItem @ExcludeGit $Info.FullName )
438
+ switch ($Children.Length ) {
439
+ 0 { break ; }
440
+ 1 {
441
+ Out-TreeInternal - Info $Children [0 ] - Depth ($Depth + 1 ) - Format $Format - Last;
442
+ break ;
443
+ }
444
+ Default {
445
+ foreach ( $child in $Children [ 0 .. ( $Children .Length - 2 )]) {
446
+ Out-TreeInternal - Info $child - Depth ($Depth + 1 ) - Format $Format
444
447
}
448
+ Out-TreeInternal - Info $Children [$Children.Length - 1 ] - Depth ($Depth + 1 ) - Format $Format - Last
445
449
}
446
450
}
447
- else {
448
- Out-TreeInternal - Info $Children - Depth ($Depth + 1 ) - Last
449
- }
450
451
}
451
452
}
452
453
@@ -665,6 +666,7 @@ $ExportSubcommandSplat = @{
665
666
' Invoke-PassGenerate'
666
667
' Invoke-PassInsert'
667
668
' Invoke-PassList'
669
+ ' Invoke-PassFind'
668
670
' Invoke-PassGit'
669
671
)
670
672
Alias = @ (
0 commit comments