Method: Fast::Cli#initialize

Defined in:
lib/fast/cli.rb

#initialize(args) ⇒ Cli

Returns a new instance of Cli.



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/fast/cli.rb', line 85

def initialize(args)
  args = replace_args_with_shortcut(args) if args.first&.start_with?('.')

  @pattern, *@files = args.reject { |arg| arg.start_with? '-' }
  @colorize = STDOUT.isatty

  option_parser.parse! args

  @files = [*@files].reject { |arg| arg.start_with?('-') }
  @sql ||= @files.any? && @files.all? { |file| file.end_with?('.sql') }

  require 'fast/sql' if @sql
end