mirror of
https://github.com/athityakumar/colorls.git
synced 2024-09-19 05:31:23 +02:00
Only filter hidden files when listing a directory
* add `.hidden-file` to fixtures * add check that `.hidden-file` is found to .travis.yml Fixes #101.
This commit is contained in:
parent
ae751cc896
commit
6fa9ca2112
3 changed files with 4 additions and 2 deletions
|
@ -19,6 +19,7 @@ script:
|
||||||
- colorls -f
|
- colorls -f
|
||||||
- colorls -l
|
- colorls -l
|
||||||
- colorls -l spec/fixtures/symlinks
|
- colorls -l spec/fixtures/symlinks
|
||||||
|
- ( cd spec/fixtures ; colorls .hidden-file ) | fgrep '.hidden-file'
|
||||||
- colorls -l README.md
|
- colorls -l README.md
|
||||||
- colorls -r
|
- colorls -r
|
||||||
- colorls -sd
|
- colorls -sd
|
||||||
|
|
|
@ -43,13 +43,14 @@ module ColorLS
|
||||||
private
|
private
|
||||||
|
|
||||||
def init_contents(path)
|
def init_contents(path)
|
||||||
@contents = if Dir.exist?(path)
|
is_directory = Dir.exist?(path)
|
||||||
|
@contents = if is_directory
|
||||||
Dir.entries(path)
|
Dir.entries(path)
|
||||||
else
|
else
|
||||||
[path]
|
[path]
|
||||||
end
|
end
|
||||||
|
|
||||||
filter_hidden_contents
|
filter_hidden_contents if is_directory
|
||||||
filter_contents(path) if @show
|
filter_contents(path) if @show
|
||||||
sort_contents(path) if @sort
|
sort_contents(path) if @sort
|
||||||
|
|
||||||
|
|
0
spec/fixtures/.hidden-file
vendored
Normal file
0
spec/fixtures/.hidden-file
vendored
Normal file
Loading…
Reference in a new issue