Class: YapShellAddonTabCompletion::BasicCompletion
- Inherits:
-
Object
- Object
- YapShellAddonTabCompletion::BasicCompletion
- Defined in:
- lib/yap-shell-addon-tab-completion/basic_completion.rb
Class Attribute Summary collapse
-
.priority ⇒ Object
Returns the value of attribute priority.
Instance Attribute Summary collapse
-
#world ⇒ Object
readonly
Returns the value of attribute world.
Instance Method Summary collapse
- #completions_for(word, words, word_index) ⇒ Object
-
#initialize(world:, word_break_characters:, path: nil) ⇒ BasicCompletion
constructor
A new instance of BasicCompletion.
Constructor Details
#initialize(world:, word_break_characters:, path: nil) ⇒ BasicCompletion
Returns a new instance of BasicCompletion.
10 11 12 13 14 15 |
# File 'lib/yap-shell-addon-tab-completion/basic_completion.rb', line 10 def initialize(world:, word_break_characters:, path:nil) @world = world @word_break_characters = word_break_characters path ||= @world.env["PATH"] @paths = path.split(":") end |
Class Attribute Details
.priority ⇒ Object
Returns the value of attribute priority.
4 5 6 |
# File 'lib/yap-shell-addon-tab-completion/basic_completion.rb', line 4 def priority @priority end |
Instance Attribute Details
#world ⇒ Object (readonly)
Returns the value of attribute world.
8 9 10 |
# File 'lib/yap-shell-addon-tab-completion/basic_completion.rb', line 8 def world @world end |
Instance Method Details
#completions_for(word, words, word_index) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/yap-shell-addon-tab-completion/basic_completion.rb', line 17 def completions_for(word, words, word_index) completions_by_name = {} if looking_for_command?(word, words, word_index) # Lowest Priority completions_by_name.merge! command_completion_matches_for(word, words) # Low Priority completions_by_name.merge! builtin_completion_matches_for(word, words) # Medium Priority completions_by_name.merge! executable_filename_completion_matches_for(word, words) # High Priority completions_by_name.merge! shell_command_completion_matches_for(word, words) # Highest Priority completions_by_name.merge! alias_completion_matches_for(word, words) else completions_by_name.merge! filename_completion_matches_for(word, words) end completions_by_name.merge! environment_variable_completions_for(word, words) completions_by_name.values end |