aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha/composer.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/alpha/composer.lua')
-rw-r--r--lua/alpha/composer.lua21
1 files changed, 21 insertions, 0 deletions
diff --git a/lua/alpha/composer.lua b/lua/alpha/composer.lua
new file mode 100644
index 0000000..e67d523
--- /dev/null
+++ b/lua/alpha/composer.lua
@@ -0,0 +1,21 @@
+local M = {}
+
+M.query = function (path)
+ if vim.fn.findfile("composer.json") == "" then
+ P("did not found the file")
+ return nil
+ end
+
+ local target = vim.fn.json_decode(vim.fn.readfile(vim.fn.getcwd() .. "/composer.json"))
+
+ for _, part in ipairs(path) do
+ target = target[part]
+ if target == nil then
+ return nil
+ end
+ end
+
+ return target
+end
+
+return M