Skip to content

Commit dc5280c

Browse files
committed
Update the arg helps
1 parent d2eff5a commit dc5280c

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

backend/cli.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def run(host: str, port: int, reload: bool, workers: int | None) -> None:
4949

5050

5151
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
5353
) -> None:
5454
if not path and not repo_url:
5555
raise cappa.Exit('path 或 repo_url 必须指定其中一项', code=1)
@@ -68,7 +68,7 @@ async def install_plugin(
6868
console.print(Text(f'插件 {plugin_name} 安装成功', style='bold green'))
6969

7070
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:
7272
console.print(Text('开始自动执行插件 SQL 脚本...', style='bold cyan'))
7373
await execute_sql_scripts(sql_file)
7474

@@ -128,23 +128,24 @@ class Add:
128128
str | None,
129129
cappa.Arg(long=True, help='Git 插件的仓库地址'),
130130
]
131-
execute_sql: Annotated[
131+
no_sql: Annotated[
132132
bool,
133-
cappa.Arg(long=True, default=False, help='启用插件安装后自动执行 SQL 脚本'),
133+
cappa.Arg(long=True, default=False, help='禁用插件 SQL 脚本自动执行'),
134134
]
135135
db_type: Annotated[
136136
DataBaseType,
137-
cappa.Arg(long=True, default='mysql', help='指定数据库类型,需启用 `--sql`'),
137+
cappa.Arg(long=True, default='mysql', help='执行插件 SQL 脚本的数据库类型'),
138138
]
139139
pk_type: Annotated[
140140
PrimaryKeyType,
141-
cappa.Arg(long=True, default='autoincrement', help='指定数据库主键类型,需启用 `--sql`'),
141+
cappa.Arg(long=True, default='autoincrement', help='执行插件 SQL 脚本数据库主键类型'),
142142
]
143143

144144
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)
146146

147147

148+
@cappa.command(help='一个高效的 fba 命令行界面')
148149
@dataclass
149150
class FbaCli:
150151
version: Annotated[
@@ -153,7 +154,7 @@ class FbaCli:
153154
]
154155
sql: Annotated[
155156
str,
156-
cappa.Arg(long=True, default='', help='脚本文件绝对路径,使用当前数据库配置在事务中执行 SQL 脚本'),
157+
cappa.Arg(long=True, default='', help='在事务中执行 SQL 脚本'),
157158
]
158159
subcmd: cappa.Subcommands[Run | Add | None] = None
159160

0 commit comments

Comments
 (0)