Skip to content

Commit dd77ade

Browse files
committed
Merge branch 'release/v3.5.2'
2 parents b286f9b + 23e767c commit dd77ade

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

README.org

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,19 @@ If (-Not (Test-Path Variable:PSise)) { # Only run this in the console and not i
6969
So =l= yields colored output of =Get-ChildItem= and =ls= yields colored output
7070
of =Get-ChildItem | Format-Wide= equivalent.
7171

72+
Both functions have the following optional switches:
73+
74+
- -File :: Show only files.
75+
- -Directory :: Show only directories.
76+
7277
~Get-ChildItemColor~ has the following optional switch:
7378

7479
- -HumanReadableSize :: Unix style size string (e.g. M instead of MB, K instead of KB etc) (thanks to [[https://github.com/kforeverisback][kforeverisback]])
7580

7681
~Get-ChildItemColorFormatWide~ has the following optional switches:
7782

78-
- -HideHeader :: supress printing of headers (path on top).
79-
- -TrailingSlashDirectory :: add a trailing slash to directory names.
83+
- -HideHeader :: Supress printing of headers (path on top).
84+
- -TrailingSlashDirectory :: Add a trailing slash to directory names.
8085

8186
Note that if you want to use these switches as default, you have to define a function. For example,
8287

src/Get-ChildItemColor.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
RootModule = 'Get-ChildItemColor.psm1'
1111

1212
# Version number of this module.
13-
ModuleVersion = '3.5.1'
13+
ModuleVersion = '3.5.2'
1414

1515
# Supported PSEditions
1616
# CompatiblePSEditions = @()

src/Get-ChildItemColor.psm1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ function Get-ChildItemColorFormatWide {
4646
[string[]]
4747
${Path},
4848
[switch]$Force,
49+
[switch]$Directory,
50+
[switch]$File,
4951
[switch]$HideHeader,
5052
[switch]$TrailingSlashDirectory
5153
)
@@ -113,6 +115,15 @@ function Get-ChildItemColorFormatWide {
113115

114116
$nnl = ++$i % $cols -ne 0
115117

118+
if ($Directory -and $item.GetType().Name -ne 'DirectoryInfo') {
119+
$LastParentName = $ParentName
120+
continue
121+
122+
} elseif ($File -and $item.GetType().Name -ne 'FileInfo') {
123+
$LastParentName = $ParentName
124+
continue
125+
}
126+
116127
# truncate the item name
117128
$toWrite = $item.Name
118129

0 commit comments

Comments
 (0)