1616
1717
1818@click .group ()
19- def plug ():
19+ def plug () -> None :
2020 """插件管理"""
2121 pass
2222
@@ -30,7 +30,11 @@ def _get_data_path() -> Path:
3030 return (base / "data" ).resolve ()
3131
3232
33- def display_plugins (plugins , title = None , color = None ):
33+ def display_plugins (
34+ plugins : list [dict ],
35+ title : str | None = None ,
36+ color : int | tuple [int , int , int ] | str | None = None ,
37+ ) -> None :
3438 if title :
3539 click .echo (click .style (title , fg = color , bold = True ))
3640
@@ -47,7 +51,7 @@ def display_plugins(plugins, title=None, color=None):
4751
4852@plug .command ()
4953@click .argument ("name" )
50- def new (name : str ):
54+ def new (name : str ) -> None :
5155 """创建新插件"""
5256 base_path = _get_data_path ()
5357 plug_path = base_path / "plugins" / name
@@ -102,7 +106,7 @@ def new(name: str):
102106
103107@plug .command ()
104108@click .option ("--all" , "-a" , is_flag = True , help = "列出未安装的插件" )
105- def list (all : bool ):
109+ def list (all : bool ) -> None :
106110 """列出插件"""
107111 base_path = _get_data_path ()
108112 plugins = build_plug_list (base_path / "plugins" )
@@ -143,7 +147,7 @@ def list(all: bool):
143147@plug .command ()
144148@click .argument ("name" )
145149@click .option ("--proxy" , help = "代理服务器地址" )
146- def install (name : str , proxy : str | None ):
150+ def install (name : str , proxy : str | None ) -> None :
147151 """安装插件"""
148152 base_path = _get_data_path ()
149153 plug_path = base_path / "plugins"
@@ -166,7 +170,7 @@ def install(name: str, proxy: str | None):
166170
167171@plug .command ()
168172@click .argument ("name" )
169- def remove (name : str ):
173+ def remove (name : str ) -> None :
170174 """卸载插件"""
171175 base_path = _get_data_path ()
172176 plugins = build_plug_list (base_path / "plugins" )
@@ -189,7 +193,7 @@ def remove(name: str):
189193@plug .command ()
190194@click .argument ("name" , required = False )
191195@click .option ("--proxy" , help = "Github代理地址" )
192- def update (name : str , proxy : str | None ):
196+ def update (name : str , proxy : str | None ) -> None :
193197 """更新插件"""
194198 base_path = _get_data_path ()
195199 plug_path = base_path / "plugins"
@@ -227,7 +231,7 @@ def update(name: str, proxy: str | None):
227231
228232@plug .command ()
229233@click .argument ("query" )
230- def search (query : str ):
234+ def search (query : str ) -> None :
231235 """搜索插件"""
232236 base_path = _get_data_path ()
233237 plugins = build_plug_list (base_path / "plugins" )
0 commit comments