mirror of
https://github.com/athityakumar/colorls.git
synced 2024-09-19 05:31:23 +02:00
Adds support for handling files and globs as input (#65)
* Added support for handling files as input (#58) * Added usage case to Travis config (#58)
This commit is contained in:
parent
a578f7e5da
commit
10b2198ec8
3 changed files with 9 additions and 2 deletions
|
@ -19,6 +19,8 @@ script:
|
|||
- colorls -sf
|
||||
- colorls -1
|
||||
- colorls -r
|
||||
- colorls README.md
|
||||
- colorls *
|
||||
|
||||
install:
|
||||
- gem install bundler
|
||||
|
|
|
@ -33,7 +33,12 @@ module ColorLS
|
|||
private
|
||||
|
||||
def init_contents
|
||||
@contents = Dir.entries(@input) - %w[. ..]
|
||||
@contents = if Dir.exist?(@input)
|
||||
Dir.entries(@input) - %w[. ..]
|
||||
else
|
||||
[@input]
|
||||
end
|
||||
|
||||
@contents.keep_if { |x| !x.start_with? '.' } unless @all
|
||||
filter_contents if @show
|
||||
sort_contents if @sort
|
||||
|
|
|
@ -19,7 +19,7 @@ module ColorLS
|
|||
return Core.new(@opts).ls if @args.empty?
|
||||
|
||||
@args.each do |path|
|
||||
next STDERR.puts "\n Specified directory '#{path}' doesn't exist.".colorize(:red) unless Dir.exist?(path)
|
||||
next STDERR.puts "\n Specified path '#{path}' doesn't exist.".colorize(:red) unless File.exist?(path)
|
||||
Core.new(path, @opts).ls
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue