Class: ColorLS::Flags
- Inherits:
-
Object
- Object
- ColorLS::Flags
- Defined in:
- lib/colorls/flags.rb
Defined Under Namespace
Classes: Option
Instance Method Summary collapse
-
#initialize(*args) ⇒ Flags
constructor
A new instance of Flags.
- #options ⇒ Object
- #process ⇒ Object
Constructor Details
#initialize(*args) ⇒ Flags
Returns a new instance of Flags.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/colorls/flags.rb', line 8 def initialize(*args) @args = args @light_colors = false @opts = default_opts @report_mode = false @exit_status_code = 0 return unless @opts[:mode] == :tree # FIXME: `--all` and `--tree` do not work together, use `--almost-all` instead @opts[:almost_all] = true if @opts[:all] @opts[:all] = false end |
Instance Method Details
#options ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/colorls/flags.rb', line 35 def list = @parser.top.list + @parser.base.list result = list.collect do |o| next unless o.respond_to? :desc flags = o.short + o.long next if flags.empty? Option.new(flags, o.desc) end result.compact end |
#process ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/colorls/flags.rb', line 25 def process init_locale @args = ['.'] if @args.empty? process_args end |