Class: ColorLS::Flags
- Inherits:
-
Object
- Object
- ColorLS::Flags
- Defined in:
- lib/colorls/flags.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ Flags
constructor
A new instance of Flags.
- #process ⇒ Object
Constructor Details
#initialize(*args) ⇒ Flags
Returns a new instance of Flags.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/colorls/flags.rb', line 6 def initialize(*args) @args = args @light_colors = false @mode = :one_per_line unless STDOUT.tty? @opts = { show: false, sort: false, all: false, almost_all: false, report: false, git_status: false, colors: [] } # handle mutual exclusive options i[tree long one_per_line].each do |value| @opts[value] = @mode == value end return unless @mode == :tree # FIXME: `--all` and `--tree` do not work together, use `--almost-all` instead @opts[:almost_all] = true if @opts[:all] @opts[:all] = false # `--tree` does not support reports @opts[:report] = false end |
Instance Method Details
#process ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/colorls/flags.rb', line 38 def process return Core.new(@opts).ls if @args.empty? @args.each do |path| next STDERR.puts "\n Specified path '#{path}' doesn't exist.".colorize(:red) unless File.exist?(path) Core.new(path, @opts).ls end end |