Skip to content

Commit

Permalink
allow cmds without args to specify default_option
Browse files Browse the repository at this point in the history
  • Loading branch information
cldwalker committed Nov 13, 2009
1 parent 865fbd9 commit 5f24291
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/boson/scientist.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def translate_and_render(obj, command, args)
def translate_args(obj, command, args)
@obj, @command, @args = obj, command, args
# prepends default option
if @command.default_option && @command.arg_size == 1 && !@command.has_splat_args? && @args[0].to_s[/./] != '-'
if @command.default_option && @command.arg_size <= 1 && !@command.has_splat_args? && @args[0].to_s[/./] != '-'
@args[0] = "--#{@command.default_option}=#{@args[0]}" unless @args.join.empty? || @args[0].is_a?(Hash)
end
@command.options ||= {}
Expand Down

0 comments on commit 5f24291

Please sign in to comment.