Skip to content

Compatible with Get-ChildItem and add -h or -HumanReadable flag similar to ls -h in Unix #56

@kforeverisback

Description

@kforeverisback

Thanks for this awesome module! I use it almost daily.
It gives me good color output as well as human-readable sizes! Awesome!!

Currently the Get-ChilditemColor* is not output compatible with the Get-ChildItem.

Get-ChilditemColor outputs:

    Directory:  C:\Users\kushal

Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--          8/3/2024   3:03 AM        1   Searches
d----          9/8/2020  11:49 AM        1   source
d-r--         7/28/2024   7:36 AM        1   Videos
d----         9/19/2023  10:35 AM        1   vimfiles
d----          6/2/2024   4:32 PM        1   VirtualBox VMs
d----          1/7/2022   9:51 AM        1   wslu
d----          4/5/2023   2:41 PM        1   XLensDemo_assets
-a---          3/8/2024   2:12 AM    36.68KB _viminfo
-a---          3/6/2023   3:20 PM     1.65KB _vimrc
-a---         2/13/2023   1:01 PM     7.67KB .bash_history
-a---         1/12/2024  12:01 AM       16   .esd_auth
-a---        12/22/2022   3:59 PM       56   .git-cred-windows
-a---         12/8/2021  11:21 PM      153   .git-user-info
-a---          2/1/2024  12:49 PM     2.05KB .gitconfig
-a---          2/1/2024  12:49 PM       27   .gitconfig-windows

Notice the length column, where it is different from Get-ChildItem output. In Get-ChildItem:

  1. The directory entries doesn't show 1 as size.
  2. The file size always shows bytes instead of human-readable format (KB,MB,GB etc).

The size item makes it harder to parse output in pipe.
Not sure if Get-ChildItemColor was intended to be output compatible with the original Get-ChildItem.
Maybe we can fix the directory size (1) and add a -h and/or -HumanReadable flag similar to Unix's ls -h that'll show KB,MB,GB size but by default will show bytes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions