mirror of
https://github.com/athityakumar/colorls.git
synced 2024-09-12 05:31:14 +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 -l
|
||||
- colorls -l spec/fixtures/symlinks
|
||||
- ( cd spec/fixtures ; colorls .hidden-file ) | fgrep '.hidden-file'
|
||||
- colorls -l README.md
|
||||
- colorls -r
|
||||
- colorls -sd
|
||||
|
|
|
@ -43,13 +43,14 @@ module ColorLS
|
|||
private
|
||||
|
||||
def init_contents(path)
|
||||
@contents = if Dir.exist?(path)
|
||||
is_directory = Dir.exist?(path)
|
||||
@contents = if is_directory
|
||||
Dir.entries(path)
|
||||
else
|
||||
[path]
|
||||
end
|
||||
|
||||
filter_hidden_contents
|
||||
filter_hidden_contents if is_directory
|
||||
filter_contents(path) if @show
|
||||
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