Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

indent filter for tree

What it is?

filter for tree command.
can indent directories and files without using indentation line.
for linux ( filter.sh ) and windows ( filter.ps1 ).

for Linux

Prerequisites

  • jq
  • python3.x

Usage

tree [${TARGET_DIRECTORY}] -J | ./filter.sh

example

tree command only

$ tree ./directory0
./directory0
├── directory1
│   ├── directory2
│   │   ├── directory3
│   │   └── file3
│   └── file2
└── file1

tree commnad with filter

$ tree ./directory0 -J | ./filter.sh
./directory0/
        directory1/
                directory2/
                        directory3/
                        file3
                file2
        file1
$

for Windows

Prerequisites

  • Windows Powershell

Usage

create filter (see filter.ps1.)

PS C:\test> filter IndentFilter {
% { $_ -replace "^(.*[+,\\\\]-.*)$","$&\" } |
% { $_ -replace "\|   " ,"`t" }  |
% { $_ -replace "\+---" ,"`t" }  |
% { $_ -replace "\\---" ,"`t" }  |
% { $_ -replace "    "  ,"`t" }  |
% { If ( $_ -notmatch "`t+$" ){$_} }
}

use filter

tree /F /A [TARGET_DIRECTORY] | IndentFilter

example

tree command only

PS C:\test> tree .\directory0 /F /A
C:\TEST\DIRECTORY0
|   file1
|
\---directory1
    |   file2
    |
    \---directory2
        |   file3
        |
        \---directory3
PS C:\test>

tree commnad with filter

PS C:\test> tree .\directory0 /F /A | IndentFilter
C:\TEST\DIRECTORY0
        file1
        directory1\
                file2
                directory2\
                        file3
                        directory3\
PS C:\test>

About

Filter for tree command. It can indent without using indentation line.

Topics

Resources

License

Releases

No releases published

Packages

No packages published