diff options
| -rw-r--r-- | xmake/modules/private/xrepo/action/update-repo.lua | 12 | ||||
| -rw-r--r-- | xmake/plugins/repo/main.lua | 15 |
2 files changed, 23 insertions, 4 deletions
diff --git a/xmake/modules/private/xrepo/action/update-repo.lua b/xmake/modules/private/xrepo/action/update-repo.lua index 8746a91be..779b7b2e0 100644 --- a/xmake/modules/private/xrepo/action/update-repo.lua +++ b/xmake/modules/private/xrepo/action/update-repo.lua @@ -25,10 +25,13 @@ import("core.base.option") function menu_options() -- description - local description = "Update all local repositories from remote." + local description = "Update the local repositories from remote." -- menu options - local options = {} + local options = + { + {nil, "name", "v", nil, "The repository name."} + } -- show menu options local function show_options() @@ -67,10 +70,13 @@ function update_repository() if option.get("diagnosis") then table.insert(repo_argv, "-D") end + local name = option.get("name") + if name then + table.insert(repo_argv, name) + end os.vexecv(os.programfile(), repo_argv) end --- main entry function main() update_repository() end diff --git a/xmake/plugins/repo/main.lua b/xmake/plugins/repo/main.lua index 28755cae3..4e50e23d2 100644 --- a/xmake/plugins/repo/main.lua +++ b/xmake/plugins/repo/main.lua @@ -95,7 +95,12 @@ function _update() environment.enter() -- trace - printf("updating repositories .. ") + local name = option.get("name") + if name then + cprintf("updating repository ${bright}%s${clear} .. ", name) + else + printf("updating repositories .. ") + end if option.get("verbose") then print("") end @@ -105,6 +110,14 @@ function _update() -- get all repositories (local first) local repos = table.join(repository.repositories(false), repository.repositories(true)) + if name then + for _, repo in ipairs(repos) do + if repo:name() == name then + repos = {repo} + break + end + end + end -- pull all repositories local pulled = {} |
