mdify-cli 3.0.1__py3-none-any.whl → 3.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mdify/__init__.py +1 -1
- mdify/cli.py +14 -5
- mdify/formatting.py +29 -0
- {mdify_cli-3.0.1.dist-info → mdify_cli-3.0.2.dist-info}/METADATA +1 -1
- {mdify_cli-3.0.1.dist-info → mdify_cli-3.0.2.dist-info}/RECORD +9 -8
- {mdify_cli-3.0.1.dist-info → mdify_cli-3.0.2.dist-info}/WHEEL +0 -0
- {mdify_cli-3.0.1.dist-info → mdify_cli-3.0.2.dist-info}/entry_points.txt +0 -0
- {mdify_cli-3.0.1.dist-info → mdify_cli-3.0.2.dist-info}/licenses/LICENSE +0 -0
- {mdify_cli-3.0.1.dist-info → mdify_cli-3.0.2.dist-info}/top_level.txt +0 -0
mdify/__init__.py
CHANGED
mdify/cli.py
CHANGED
|
@@ -1050,6 +1050,9 @@ def main_async_remote(args) -> int:
|
|
|
1050
1050
|
|
|
1051
1051
|
async def async_main() -> int:
|
|
1052
1052
|
"""Async implementation of remote conversion."""
|
|
1053
|
+
from mdify.formatting import Colorizer
|
|
1054
|
+
|
|
1055
|
+
color = Colorizer(sys.stderr)
|
|
1053
1056
|
|
|
1054
1057
|
# Resolve timeout value: CLI > env > default 1200
|
|
1055
1058
|
timeout = args.timeout or int(os.environ.get("MDIFY_TIMEOUT", 1200))
|
|
@@ -1238,14 +1241,17 @@ def main_async_remote(args) -> int:
|
|
|
1238
1241
|
try:
|
|
1239
1242
|
for idx, input_file in enumerate(files_to_convert, 1):
|
|
1240
1243
|
if not args.quiet:
|
|
1241
|
-
print(
|
|
1244
|
+
print(
|
|
1245
|
+
f"\n{color.cyan(f'[{idx}/{len(files_to_convert)}] Processing:')} {input_file.name}",
|
|
1246
|
+
file=sys.stderr,
|
|
1247
|
+
)
|
|
1242
1248
|
|
|
1243
1249
|
try:
|
|
1244
1250
|
# Upload file
|
|
1245
1251
|
remote_file_path = f"{work_dir}/{input_file.name}"
|
|
1246
1252
|
|
|
1247
1253
|
if not args.quiet:
|
|
1248
|
-
print(f" Uploading to {remote_file_path}...", file=sys.stderr)
|
|
1254
|
+
print(f" {color.cyan('Uploading to')} {remote_file_path}...", file=sys.stderr)
|
|
1249
1255
|
|
|
1250
1256
|
await transfer_manager.upload_file(
|
|
1251
1257
|
local_path=str(input_file),
|
|
@@ -1254,11 +1260,11 @@ def main_async_remote(args) -> int:
|
|
|
1254
1260
|
)
|
|
1255
1261
|
|
|
1256
1262
|
if not args.quiet:
|
|
1257
|
-
print(f" ✓ Upload complete", file=sys.stderr)
|
|
1263
|
+
print(f" {color.green('✓ Upload complete')}", file=sys.stderr)
|
|
1258
1264
|
|
|
1259
1265
|
# Convert via remote container
|
|
1260
1266
|
if not args.quiet:
|
|
1261
|
-
print(f" Converting via remote container...", file=sys.stderr)
|
|
1267
|
+
print(f" {color.cyan('Converting via remote container')}...", file=sys.stderr)
|
|
1262
1268
|
|
|
1263
1269
|
# Determine output path
|
|
1264
1270
|
output_dir = Path(args.out_dir)
|
|
@@ -1279,7 +1285,10 @@ def main_async_remote(args) -> int:
|
|
|
1279
1285
|
# Check if output exists and skip if not overwrite
|
|
1280
1286
|
if output_file.exists() and not args.overwrite:
|
|
1281
1287
|
if not args.quiet:
|
|
1282
|
-
print(
|
|
1288
|
+
print(
|
|
1289
|
+
f" {color.yellow('⊘ Skipped:')} {output_file} already exists (use --overwrite to replace)",
|
|
1290
|
+
file=sys.stderr,
|
|
1291
|
+
)
|
|
1283
1292
|
continue
|
|
1284
1293
|
|
|
1285
1294
|
# Convert using remote container's HTTP API
|
mdify/formatting.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"""Formatting helpers for CLI output."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
from typing import TextIO
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Colorizer:
|
|
10
|
+
"""ANSI color helper for terminal output."""
|
|
11
|
+
|
|
12
|
+
def __init__(self, stream: TextIO) -> None:
|
|
13
|
+
force_color = os.environ.get("FORCE_COLOR")
|
|
14
|
+
no_color = os.environ.get("NO_COLOR")
|
|
15
|
+
self.enabled = bool(force_color) or (stream.isatty() and not no_color)
|
|
16
|
+
|
|
17
|
+
def color(self, text: str, code: str) -> str:
|
|
18
|
+
if not self.enabled:
|
|
19
|
+
return text
|
|
20
|
+
return f"\033[{code}m{text}\033[0m"
|
|
21
|
+
|
|
22
|
+
def green(self, text: str) -> str:
|
|
23
|
+
return self.color(text, "32")
|
|
24
|
+
|
|
25
|
+
def yellow(self, text: str) -> str:
|
|
26
|
+
return self.color(text, "33")
|
|
27
|
+
|
|
28
|
+
def cyan(self, text: str) -> str:
|
|
29
|
+
return self.color(text, "36")
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
assets/mdify.png,sha256=qUj7WXWqNwpI2KNXOW79XJwqFqa-UI0JEkmt1mmy4Rg,1820418
|
|
2
|
-
mdify/__init__.py,sha256=
|
|
2
|
+
mdify/__init__.py,sha256=T6SyoOZjbytRoip9WM4THeDUbin7s6Xq7Cb_HZAAi5Q,90
|
|
3
3
|
mdify/__main__.py,sha256=bhpJ00co6MfaVOdH4XLoW04NtLYDa_oJK7ODzfLrn9M,143
|
|
4
|
-
mdify/cli.py,sha256=
|
|
4
|
+
mdify/cli.py,sha256=f7_3bka83jfvYXp2L6Zk4trPuMrN3hJ51iueK7J1Szk,74065
|
|
5
5
|
mdify/container.py,sha256=BjL5ZR__n1i_WHifXKllTPoqO7IuOUdPDo5esuNg0Iw,8213
|
|
6
6
|
mdify/docling_client.py,sha256=xuQR6sC1v3EPloOSwExoHCqT4uUxE8myYq-Yeby3C2I,7975
|
|
7
|
+
mdify/formatting.py,sha256=lJKhMbDPcaWCdyEa7aKwAm_desaWvkfDc8C3EP7LWp4,790
|
|
7
8
|
mdify/ssh/__init__.py,sha256=SmRWgwEvAQZ_ARHlKTb9QDPwVAcz6dvPUks2pZFWLAU,271
|
|
8
9
|
mdify/ssh/client.py,sha256=MNMBrL5Xk2rFo28Ytw80hWX2vQ3_CXlIL4VathNtK-I,14873
|
|
9
10
|
mdify/ssh/models.py,sha256=jpbDS1yGhd7Xwq2tW7bZv14mTBlR8DCfhT4x-Xf2Wq4,17676
|
|
10
11
|
mdify/ssh/remote_container.py,sha256=kmScAlmHI9rJLKliYcYQXDZHF7PYYiD-_rRV-S0fffM,8462
|
|
11
12
|
mdify/ssh/transfer.py,sha256=aZZgylDjoqx6PEpaMu2zxkDF04w7btiOnMExmtt922A,10574
|
|
12
|
-
mdify_cli-3.0.
|
|
13
|
-
mdify_cli-3.0.
|
|
14
|
-
mdify_cli-3.0.
|
|
15
|
-
mdify_cli-3.0.
|
|
16
|
-
mdify_cli-3.0.
|
|
17
|
-
mdify_cli-3.0.
|
|
13
|
+
mdify_cli-3.0.2.dist-info/licenses/LICENSE,sha256=NWM66Uv-XuSMKaU-gaPmvfyk4WgE6zcIPr78wyg6GAo,1065
|
|
14
|
+
mdify_cli-3.0.2.dist-info/METADATA,sha256=To3g3ZuGkKaTvMw6wPv8zMEJYDajPIOQ4_bJvJhZYX8,14766
|
|
15
|
+
mdify_cli-3.0.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
16
|
+
mdify_cli-3.0.2.dist-info/entry_points.txt,sha256=0Xki8f5lADQUtwdt6Eq_FEaieI6Byhk8UE7BuDhChMg,41
|
|
17
|
+
mdify_cli-3.0.2.dist-info/top_level.txt,sha256=qltzf7h8owHq7dxCdfCkSHY8gT21hn1_E8P-VWS_OKM,6
|
|
18
|
+
mdify_cli-3.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|