summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-08-27 20:19:33 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-08-27 22:12:47 -0400
commitc4dd59ff65b85360dacb03f6a97d96627b4c1cb1 (patch)
treeb4f36eda527b123cc2f03b517bb25c555947a41b /lua
parent17dfffded5320bc0f186f03ed75daf403aff9645 (diff)
Add first draft of entry
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/entry.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/lua/telescope/entry.lua b/lua/telescope/entry.lua
new file mode 100644
index 0000000..97b5414
--- /dev/null
+++ b/lua/telescope/entry.lua
@@ -0,0 +1,27 @@
+local Entry = {}
+Entry.__index = Entry
+
+-- TODO: Can we / should we make it so that "display" and "ordinal" are just values, instead of functions.
+-- It seems like that's what you'd want... No need to call the functions a million times.
+
+-- Pass in a table, that contains some state
+-- Table determines it's ordinal value
+function Entry:new(line_or_obj)
+ if type(line_or_obj) == "string" then
+ return setmetatable({
+ valid = line_or_obj ~= "",
+
+ value = line_or_obj,
+ ordinal = line_or_obj,
+ display = line_or_obj,
+ }, self)
+ else
+ return line_or_obj
+ end
+end
+
+function Entry:__tostring()
+ return "<" .. self.display .. ">"
+end
+
+return Entry