Skip to content

Commit

Permalink
set init value to @completion_proc. fix bug at complement.
Browse files Browse the repository at this point in the history
  • Loading branch information
jugyo committed Jan 14, 2009
1 parent 80cc05a commit 3d7ebf4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/termtter/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(args)
@name = args[:name].to_sym
@aliases = args[:aliases] || []
@exec_proc = args[:exec_proc] || proc {|arg|}
@completion_proc = args[:completion_proc]
@completion_proc = args[:completion_proc] || proc {|command, arg| [] }
@help = args[:help]
end

Expand All @@ -22,7 +22,7 @@ def complement(input)
if command_info
[completion_proc.call(command_info[0], command_info[1])].flatten.compact
else
[name.to_s]
[name.to_s].grep(/^#{Regexp.quote(input)}/)
end
end

Expand Down

0 comments on commit 3d7ebf4

Please sign in to comment.