Class: Zync::Generators::Cli

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/zync-gen/generators/cli.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/zync-gen/generators/cli.rb', line 6

def setup       
  generator_kind  = ARGV.delete_at(0).to_s.downcase.to_sym if ARGV[0].present?
  generator_class = Zync::Generators.mappings[generator_kind]

  if generator_class
    args = ARGV.empty? && generator_class.require_arguments? ? ["-h"] : ARGV
    generator_class.start(args)
  else
    puts "FAIL"
    # TODO: specify generators
  end
end