@@ -49,7 +49,7 @@ def run(host: str, port: int, reload: bool, workers: int | None) -> None:
49
49
50
50
51
51
async def install_plugin (
52
- path : str , repo_url : str , execute_sql : bool , db_type : DataBaseType , pk_type : PrimaryKeyType
52
+ path : str , repo_url : str , no_sql : bool , db_type : DataBaseType , pk_type : PrimaryKeyType
53
53
) -> None :
54
54
if not path and not repo_url :
55
55
raise cappa .Exit ('path 或 repo_url 必须指定其中一项' , code = 1 )
@@ -68,7 +68,7 @@ async def install_plugin(
68
68
console .print (Text (f'插件 { plugin_name } 安装成功' , style = 'bold green' ))
69
69
70
70
sql_file = await get_plugin_sql (plugin_name , db_type , pk_type )
71
- if sql_file and execute_sql :
71
+ if sql_file and not no_sql :
72
72
console .print (Text ('开始自动执行插件 SQL 脚本...' , style = 'bold cyan' ))
73
73
await execute_sql_scripts (sql_file )
74
74
@@ -128,23 +128,24 @@ class Add:
128
128
str | None ,
129
129
cappa .Arg (long = True , help = 'Git 插件的仓库地址' ),
130
130
]
131
- execute_sql : Annotated [
131
+ no_sql : Annotated [
132
132
bool ,
133
- cappa .Arg (long = True , default = False , help = '启用插件安装后自动执行 SQL 脚本 ' ),
133
+ cappa .Arg (long = True , default = False , help = '禁用插件 SQL 脚本自动执行 ' ),
134
134
]
135
135
db_type : Annotated [
136
136
DataBaseType ,
137
- cappa .Arg (long = True , default = 'mysql' , help = '指定数据库类型,需启用 `--sql` ' ),
137
+ cappa .Arg (long = True , default = 'mysql' , help = '执行插件 SQL 脚本的数据库类型 ' ),
138
138
]
139
139
pk_type : Annotated [
140
140
PrimaryKeyType ,
141
- cappa .Arg (long = True , default = 'autoincrement' , help = '指定数据库主键类型,需启用 `--sql` ' ),
141
+ cappa .Arg (long = True , default = 'autoincrement' , help = '执行插件 SQL 脚本数据库主键类型 ' ),
142
142
]
143
143
144
144
async def __call__ (self ):
145
- await install_plugin (self .path , self .repo_url , self .execute_sql , self .db_type , self .pk_type )
145
+ await install_plugin (self .path , self .repo_url , self .no_sql , self .db_type , self .pk_type )
146
146
147
147
148
+ @cappa .command (help = '一个高效的 fba 命令行界面' )
148
149
@dataclass
149
150
class FbaCli :
150
151
version : Annotated [
@@ -153,7 +154,7 @@ class FbaCli:
153
154
]
154
155
sql : Annotated [
155
156
str ,
156
- cappa .Arg (long = True , default = '' , help = '脚本文件绝对路径,使用当前数据库配置在事务中执行 SQL 脚本' ),
157
+ cappa .Arg (long = True , default = '' , help = '在事务中执行 SQL 脚本' ),
157
158
]
158
159
subcmd : cappa .Subcommands [Run | Add | None ] = None
159
160
0 commit comments