Class: Bashly::CompletionBuilder
- Inherits:
-
Object
- Object
- Bashly::CompletionBuilder
- Defined in:
- lib/bashly/completion_builder.rb
Constant Summary collapse
- BUILTIN_PATTERN =
/\A<([^>]+)>\z/
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(command, with_version: true) ⇒ CompletionBuilder
constructor
A new instance of CompletionBuilder.
Constructor Details
#initialize(command, with_version: true) ⇒ CompletionBuilder
Returns a new instance of CompletionBuilder.
5 6 7 8 9 10 11 12 |
# File 'lib/bashly/completion_builder.rb', line 5 def initialize(command, with_version: true) @command = command @with_version = with_version @patterns = [] @options = {} @tokens = {} @token_sources = {} end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/bashly/completion_builder.rb', line 14 def call add_command @command, inherited_global_groups: [] result = { 'patterns' => @patterns } result['options'] = @options if @options.any? result['tokens'] = @tokens if @tokens.any? result end |