bcmd 0.5.5__py3-none-any.whl → 0.5.7__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.
bcmd/tasks/__init__.py CHANGED
@@ -12,4 +12,5 @@ from . import mirror
12
12
  from . import project
13
13
  from . import proxy
14
14
  from . import time
15
+ from . import upgrade
15
16
  from . import venv
bcmd/tasks/code.py CHANGED
@@ -1,4 +1,5 @@
1
1
  import asyncio
2
+ import os
2
3
  from pathlib import Path
3
4
  from typing import Final
4
5
 
@@ -112,14 +113,18 @@ async def to_lf(
112
113
  '.pytest_cache',
113
114
  '__pycache__',
114
115
  ]
116
+ path = path or Path(os.getcwd())
115
117
  files = bpath.listFile(path, True)
116
118
  # 剔除子目录是这些的文件 .git venv ...
117
119
  files = [x for x in files if not any([y in x.parts for y in ignoreSubDirs])]
118
120
 
119
121
  async def convertFile(file: Path):
120
122
  try:
121
- await bfile.toLf(file)
122
- print(file)
123
+ content = await bfile.readText(file)
124
+ if '\r\n' in content:
125
+ content = content.replace('\r\n', '\n')
126
+ await bfile.writeText(file, content)
127
+ printYellow(file)
123
128
  except:
124
129
  pass
125
130
 
bcmd/tasks/lib.py CHANGED
@@ -32,7 +32,7 @@ async def tidy_dependencies(
32
32
  ignoreLibAry = sorted(list(set(ignoreLibAry) & set(libAry)))
33
33
  libAry = sorted(list(set(libAry) - set(ignoreLibAry)))
34
34
  replaceContent = '\n'.join([f" '{x}'," for x in libAry]) + '\n' + '\n'.join([f" # '{x}'," for x in ignoreLibAry])
35
- newContent = re.sub(r'dependencies = \[(.*?)\]', f"dependencies = [\n{replaceContent}\n]", oldContent, 0, re.DOTALL)
35
+ newContent = re.sub(r'dependencies = \[(.*?)\n\]', f"dependencies = [\n{replaceContent}\n]", oldContent, 0, re.DOTALL)
36
36
  if oldContent != newContent:
37
37
  await bfile.writeText(pyprojectTomlFile, newContent)
38
38
  bcolor.printYellow(pyprojectTomlFile)
@@ -93,7 +93,7 @@ async def build(
93
93
 
94
94
  def _getIgnoreLibAry(content: str) -> list[str]:
95
95
  '获取pyproject.toml中屏蔽的第三方库'
96
- content = re.findall(r'dependencies = \[(.*?)\]', content, re.DOTALL)[0]
96
+ content = re.findall(r'dependencies = \[(.*?)\n\]', content, re.DOTALL)[0]
97
97
  ary = textToAry(content)
98
98
  return sorted([x[1:].replace('"', '').replace("'", '').replace(',', '').strip() for x in filter(lambda x: x.startswith('#'), ary)])
99
99
 
bcmd/tasks/proxy.py CHANGED
@@ -30,7 +30,7 @@ async def proxy(
30
30
  elif set(['powershell.exe', 'pwsh.exe']) & set(processNameAry):
31
31
  template = powerShellTemplate
32
32
 
33
- btask.assertTrue(template, '不支持当前终端({processNameAry})')
33
+ btask.assertTrue(template, f'不支持当前终端({processNameAry})')
34
34
  lineAry = textToAry(template.format(port))
35
35
  msg = '\n'.join(lineAry)
36
36
  bcolor.printMagenta('\r\n' + msg)
bcmd/tasks/upgrade.py ADDED
@@ -0,0 +1,18 @@
1
+ from typing import Final
2
+
3
+ import pyperclip
4
+ from beni import bcolor, btask
5
+ from beni.bfunc import syncCall
6
+
7
+ app: Final = btask.app
8
+
9
+
10
+ @app.command()
11
+ @syncCall
12
+ async def upgrade():
13
+ '使用 pipx 官方源更新 bcmd 到最新版本'
14
+ cmd = 'pipx upgrade bcmd -i https://pypi.org/simple'
15
+ pyperclip.copy(cmd + '\n')
16
+ bcolor.printGreen(cmd)
17
+ bcolor.printGreen('已复制到剪贴板(需要手动执行)')
18
+ bcolor.printGreen('OK')
bcmd/tasks/venv.py CHANGED
@@ -37,6 +37,7 @@ async def install_benimang(
37
37
  path: Path = typer.Option(None, '--path', help='指定路径,默认当前目录'),
38
38
  ):
39
39
  '更新 benimang 库,强制使用官方源'
40
+ path = path or Path(os.getcwd())
40
41
  pip = getPipFile(path)
41
42
  await brun.run(f'{pip} install benimang -U -i https://pypi.org/simple', isPrint=True)
42
43
  await _venv(
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: bcmd
3
- Version: 0.5.5
3
+ Version: 0.5.7
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
7
7
  Keywords: benimang,beni,bcmd
8
8
  Requires-Python: >=3.10
9
- Requires-Dist: benimang==0.7.5
9
+ Requires-Dist: benimang==0.7.12
10
10
  Requires-Dist: build
11
11
  Requires-Dist: cryptography
12
12
  Requires-Dist: pathspec
@@ -8,23 +8,24 @@ bcmd/resources/project/main.py,sha256=xdskz_sf05fYA1SRMFCIxDjx8SnegxTbCmHpW86ItL
8
8
  bcmd/resources/project/.vscode/launch.json,sha256=Wpghb9lW9Y1wtrjqlTbyjeejDuU8BQJmBjwsLyPRh1g,478
9
9
  bcmd/resources/project/.vscode/settings.json,sha256=G4rCroWxEHcQfsqIJ6CXRHI6VGr3WYQI3KPPjH_JANs,280
10
10
  bcmd/resources/project/.vscode/tasks.json,sha256=gouhpkrqiPz7v65Jw1Rz-BCYU3sSdmphzXIYCzVnoe0,1783
11
- bcmd/tasks/__init__.py,sha256=XDE4eW0mPkUCSK9tyg1DQRGLA7A9DuTmjq5MyUiPoXs,294
11
+ bcmd/tasks/__init__.py,sha256=siqJwKgsjiIQzarBsQaucjm6VEvDr1pJDuEd7UnDXSQ,316
12
12
  bcmd/tasks/bin.py,sha256=B_e-HYOc2Cohk-1PbKHyKn3RhI8TAUfI2EBRoFEHiTM,2961
13
- bcmd/tasks/code.py,sha256=MaEnCMXiGkubslR7hLYX_8vIioN2CiEht4Nx6PtkVYY,3778
13
+ bcmd/tasks/code.py,sha256=IUs_ClZuSsBk2gavlitC8mkRrQQX9rvNDgR8cFxduBA,3992
14
14
  bcmd/tasks/crypto.py,sha256=C2welnYfdI4Tc-W1cwkboGb6bk6NGWO0MRKm4Bzo_9Q,3216
15
15
  bcmd/tasks/debian.py,sha256=B9aMIIct3vNqMJr5hTr1GegXVf20H49C27FMvRRGIzI,3004
16
16
  bcmd/tasks/download.py,sha256=XdZYKi8zQTNYWEgUxeTNDqPgP7IGYJkMmlDDC9u93Vk,2315
17
17
  bcmd/tasks/image.py,sha256=Po8jpEf4e1X68oJc2MYT446o-45RgIrl1TsODvUetBo,7782
18
18
  bcmd/tasks/json.py,sha256=WWOyvcZPYaqQgp-Tkm-uIJschNMBKPKtZN3yXz_SC5s,635
19
- bcmd/tasks/lib.py,sha256=_hlMzvXKtiHtDOX4nBcWkoqrpQ8A1PdICa01OBFdhVU,4563
19
+ bcmd/tasks/lib.py,sha256=lq-PdHxhK-5Akf7k4QaIT8mBB-sCK5or5OqEFTdphIA,4567
20
20
  bcmd/tasks/math.py,sha256=xbl5UdaDMyAjiLodDPleP4Cutrk2S3NOAgurzAgOEAE,2862
21
21
  bcmd/tasks/mirror.py,sha256=nAe8NYftMKzht16MFBj7RqXwvVhR6Jh2uuAyJLh87og,1098
22
22
  bcmd/tasks/project.py,sha256=yLYL6WNmq0mlY-hQ-SGKZ6uRjwceJxpgbP-QAo0Wk-Y,1948
23
- bcmd/tasks/proxy.py,sha256=SHYfdxrDt_TW0-7aNSuKX9oqm9CQ9tA87-7SgG794X8,1551
23
+ bcmd/tasks/proxy.py,sha256=xvxN5PClUnc5LQpmq2Wug7_LUVpJboMWLXBvL9lX7EM,1552
24
24
  bcmd/tasks/time.py,sha256=ZiqA1jdgl-TBtFSOxxP51nwv4g9iZItmkFKpf9MKelk,2453
25
- bcmd/tasks/venv.py,sha256=lxA_mzY3_s4bH28e52GqAyxiaqibGYgwkiRH23lflaQ,7636
26
- bcmd-0.5.5.dist-info/METADATA,sha256=rBe0Nc-iLPHxXXLi2BLj1RmdcTaLryc-CSX9Y1sMMXQ,474
27
- bcmd-0.5.5.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
28
- bcmd-0.5.5.dist-info/entry_points.txt,sha256=rHJrP6KEQpB-YaQqDFzEL2v88r03rxSfnzAayRvAqHU,39
29
- bcmd-0.5.5.dist-info/top_level.txt,sha256=-KrvhhtBcYsm4XhcjQvEcFbBB3VXeep7d3NIfDTrXKQ,5
30
- bcmd-0.5.5.dist-info/RECORD,,
25
+ bcmd/tasks/upgrade.py,sha256=ZiyecgVbnnoTU_LAsd78CIKA4ioc9so9pXpAM76b_0M,447
26
+ bcmd/tasks/venv.py,sha256=a7ZDyagUPQvCAXx3cZJIqJt0p1Iy5u5qmmj8iRbDQZE,7673
27
+ bcmd-0.5.7.dist-info/METADATA,sha256=VYojYhON5P2o-Vmd9J-I3tOCdWTVYqR4R6uqplVK8JI,475
28
+ bcmd-0.5.7.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
29
+ bcmd-0.5.7.dist-info/entry_points.txt,sha256=rHJrP6KEQpB-YaQqDFzEL2v88r03rxSfnzAayRvAqHU,39
30
+ bcmd-0.5.7.dist-info/top_level.txt,sha256=-KrvhhtBcYsm4XhcjQvEcFbBB3VXeep7d3NIfDTrXKQ,5
31
+ bcmd-0.5.7.dist-info/RECORD,,
File without changes