Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions src/lib/command_base.cr
Original file line number Diff line number Diff line change
Expand Up @@ -238,20 +238,24 @@ module Cli

# :nodoc:
def initialize(@__previous, @__argv)
run_callbacks_for_initialize {}
run_callbacks_for_initialize { }
end

@__option_data = Util::Var(Optarg::Model).new

# Returns option and argument values (an `OptionModel` instance).
#
# This method is the same as `#args`.
def options; __option_data; end
def options
__option_data
end

# Returns option and argument values (an `OptionModel` instance).
#
# This method is the same as `#options`.
def args; __option_data; end
def args
__option_data
end

# Returns an array of nameless argument values.
#
Expand Down Expand Up @@ -342,13 +346,14 @@ module Cli
end

@io : IoHash?

# Returns a named IO container.
def io
@io ||= if prev = @__previous
prev.io
else
Cli.new_default_io
end
prev.io
else
Cli.new_default_io
end
end

# Invokes the :out IO's puts method.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/ios/pipe.cr
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module Cli::Ios
end

# Implements `IO#write`.
def write(slice : Slice(UInt8))
def write(slice : Slice(UInt8)) : Nil
if io = @writer
io.write slice
else
Expand Down