Skip to content

Commit

Permalink
Command.creeate
Browse files Browse the repository at this point in the history
  • Loading branch information
at-grandpa committed Dec 23, 2018
1 parent 595a23b commit 6e2d24d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/clim.cr
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ class Clim
end

def self.command
Command_Main_command_of_clim_library.new
Command_Main_command_of_clim_library.create
end

def self.start_parse(argv, io : IO = STDOUT)
Command_Main_command_of_clim_library.new.parse(argv).run(io)
Command_Main_command_of_clim_library.create.parse(argv).run(io)
end

def self.start(argv)
Expand Down
10 changes: 6 additions & 4 deletions src/clim/command/macros.cr
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,15 @@ class Clim

alias OptionsForEachCommand = Options_{{ name.id.capitalize }}

def initialize
@display_version_flag = false
def self.create
self.new(OptionsForEachCommand.new)
end

def initialize(@options : Options)
@parser = OptionParser.new
@options = OptionsForEachCommand.new
@options.setup_parser(@parser)
\{% for command_class in @type.constants.select { |c| @type.constant(c).superclass.id.stringify == "Clim::Command" } %}
@sub_commands << \{{ command_class.id }}.new
@sub_commands << \{{ command_class.id }}.create
\{% end %}
end

Expand Down

0 comments on commit 6e2d24d

Please sign in to comment.