Module: Thor::Completion::Bash::Command
- Included in:
- Thor::Command
- Defined in:
- lib/thor/completion/bash.rb
Overview
Methods that need to mixed in to Thor::Command.
Instance Method Summary collapse
Instance Method Details
#bash_complete(comp_req:, index:) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/thor/completion/bash.rb', line 132 def bash_complete comp_req:, index: # TODO Handle return [] if comp_req.split logger.info __method__, cmd_name: name, options: . each_with_object( [ '--help' ] ) { |(name, opt), results| ui_name = name.to_s.tr( '_', '-' ) if opt.type == :boolean results << "--#{ ui_name }" results << "--no-#{ ui_name }" else results << "--#{ ui_name }=" end }. select { |term| term.start_with? comp_req.cur } end |