a8m / a8m/tree

Allow directories to be ignored with -I/IPattern

Đang mở
#11 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
105
Fork
17
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Currently, the `-I` flag and `IPattern` option only ignore _files_ with the given pattern. Directories matching the pattern remain in the tree.

Would it be possible to also ignore directories? I know this would break the existing API, so I'm not sure if there should be a new option for this, rather than change the existing behaviour.

The `tree` command installed with Homebrew from http://mama.indstate.edu/users/ice/tree/ does ignore directories in addition to files, as shown below:

``` bash session
$ mkdir -p rootdir/building/flowers rootdir/{road,ocean}
$ touch rootdir/building/b.txt rootdir/building/flowers/f.txt rootdir/road/r.txt rootdir/ocean/o.txt
$ tree rootdir/
rootdir/
├── building
│   ├── b.txt
│   └── flowers
│   └── f.txt
├── ocean
│   └── o.txt
└── road
└── r.txt

4 directories, 4 files
$ $GOPATH/src/github.com/a8m/tree/tree rootdir/
rootdir/
├── building
│ ├── b.txt
│ └── flowers
│ └── f.txt
├── ocean
│ └── o.txt
└── road
└── r.txt

4 directories, 4 files
$ tree -I building rootdir/
rootdir/
├── ocean
│   └── o.txt
└── road
└── r.txt

2 directories, 2 files
$ $GOPATH/src/github.com/a8m/tree/tree -I building rootdir/
rootdir/
├── building
│ ├── b.txt
│ └── flowers
│ └── f.txt
├── ocean
│ └── o.txt
└── road
└── r.txt

4 directories, 4 files
```

I'd be happy to work on this, but I'm not sure if it's something you want to add to the project. If so, I'd appreciate some guidance about how to handle backward compatibility.

Thanks!

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.