68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/openhab/console/irb.rb', line 68
def completion_candidates(_preposing, target, _postposing, bind:)
return super unless defined?(OpenHAB::Core::EntityLookup)
return super unless VALID_ENTITY_PREFIXES.include?(target[0])
this = bind.eval("self")
return super unless this.is_a?(OpenHAB::Core::EntityLookup)
matching_items = OpenHAB::DSL.items.filter_map do |item|
item.name if item.name.start_with?(target)
end
matching_things = OpenHAB::DSL.things.filter_map do |thing|
id = thing.uid.to_s.tr(":", "_")
id if id.start_with?(target)
end
matching_items | matching_things | super
end
|