新增:插件管理器分支选择功能

This commit is contained in:
2025-12-18 10:55:06 +08:00
parent 40db5ee349
commit f69ea02bb1

View File

@ -89,6 +89,10 @@ def Parse(plug_id: string, plug_options: dict<any> = {}): dict<any>
# path: string # path: string
const plug_path = tui#util#path#Join(tui#core#cached#Get('tui.plug.home'), split(plug_id, '/')[-1]) const plug_path = tui#util#path#Join(tui#core#cached#Get('tui.plug.home'), split(plug_id, '/')[-1])
plug_info['path'] = plug_path plug_info['path'] = plug_path
# branch
if has_key(plug_options, 'branch') && !empty(plug_options['branch'])
plug_info['branch'] = plug_options['branch']
endif
# enabled: bool / func # enabled: bool / func
var plug_enabled = v:true var plug_enabled = v:true
if has_key(plug_options, 'enabled') if has_key(plug_options, 'enabled')
@ -174,6 +178,9 @@ export def Install()
var plug_info = tui_plug_registed[plug_id] var plug_info = tui_plug_registed[plug_id]
if !isdirectory(plug_info['path']) if !isdirectory(plug_info['path'])
var cmds = 'git clone https://github.com/' .. plug_id .. ' ' .. plug_info['path'] var cmds = 'git clone https://github.com/' .. plug_id .. ' ' .. plug_info['path']
if has_key(plug_info, 'branch') && !empty(plug_info['branch'])
cmds = 'git clone -b ' .. plug_info['branch'] .. ' https://github.com/' .. plug_id .. ' ' .. plug_info['path']
endif
echo "executing " .. cmds echo "executing " .. cmds
system(cmds) system(cmds)
echo "install success" echo "install success"