aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <adamdharrison@gmail.com>2022-09-13 16:21:36 -0400
committerAdam <adamdharrison@gmail.com>2022-09-13 16:21:36 -0400
commite7ae9aac73e0bcae77b4c96ce01a37db58efb246 (patch)
treecfa538b3f4f1221de68ca55016b88770372cda50
parentd7dc38b2cdba6851df14bc6297ec7aa25c557a8d (diff)
downloadlite-xl-plugin-manager-e7ae9aac73e0bcae77b4c96ce01a37db58efb246.tar.gz
lite-xl-plugin-manager-e7ae9aac73e0bcae77b4c96ce01a37db58efb246.zip
Updated for remote repos to be listed.
-rw-r--r--lpm.c19
-rw-r--r--lpm.lua12
2 files changed, 7 insertions, 24 deletions
diff --git a/lpm.c b/lpm.c
index afa5581..ba9bcc0 100644
--- a/lpm.c
+++ b/lpm.c
@@ -1,22 +1,3 @@
-/* lpm.c - Core of the lite package manager.
-
-LPM is a package manager for `lite-xl`, written in C (and packed-in lua).
-
-It has the following commands:
-
-lpm add <repository remote>
-lpm rm <repository remote>
-lpm update [<repository remote>]
-lpm install <plugin name>
-lpm uninstall <plugin name>
-lpm list
-
-It stores files in a cache directory in the follwoing format:
-
-<remote url>:<branch_name|commit_name>
-
-*/
-
#include <git2.h>
#include <string.h>
#include <stdio.h>
diff --git a/lpm.lua b/lpm.lua
index 1be3cdb..d164671 100644
--- a/lpm.lua
+++ b/lpm.lua
@@ -813,14 +813,16 @@ end
local function lpm_repo_list()
if JSON then
- io.stdout:write(json.encode({ repositories = common.map(repositories, function(repo) return { remote = repo.remote, commit = repo.commit, branch = repo.branch, path = repo.local_path .. PATHSEP .. (repo.commit or repo.branch) } end) }) .. "\n")
+ io.stdout:write(json.encode({ repositories = common.map(repositories, function(repo) return { remote = repo.remote, commit = repo.commit, branch = repo.branch, path = repo.local_path .. PATHSEP .. (repo.commit or repo.branch), remotes = common.map(repository.remotes or {}, function(r) return remote.remote .. ":" .. (remote.commit or remote.branch) end) } end) }) .. "\n")
else
for i, repository in ipairs(repositories) do
+ local _, remotes = repository:parse_manifest()
if i ~= 0 then print("---------------------------") end
- print("Remote: " .. repository.remote)
- print("Branch: " .. repository.branch)
- print("Commit: " .. (repository.commit or "nil"))
- print("Path : " .. repository.local_path .. PATHSEP .. (repository.commit or repository.branch))
+ print("Remote : " .. repository.remote)
+ print("Branch : " .. repository.branch)
+ print("Commit : " .. (repository.commit or "nil"))
+ print("Path : " .. repository.local_path .. PATHSEP .. (repository.commit or repository.branch))
+ print("Remotes: " .. json.encode(common.map(repository.remotes or {}, function(r) return remote.remote .. ":" .. (remote.commit or remote.branch) end)))
end
end
end