bcmd 0.6.16__py3-none-any.whl → 0.6.18__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.

Potentially problematic release.


This version of bcmd might be problematic. Click here for more details.

bcmd/tasks/__init__.py CHANGED
@@ -10,8 +10,8 @@ from . import lib
10
10
  from . import math
11
11
  from . import mirror
12
12
  from . import pdf
13
+ from . import project
13
14
  from . import proxy
14
15
  from . import time
15
16
  from . import upgrade
16
17
  from . import wasabi
17
- from . import wslProxy
bcmd/tasks/project.py ADDED
@@ -0,0 +1,34 @@
1
+ import os
2
+ from pathlib import Path
3
+ from typing import Final
4
+
5
+ from beni import btask, bpath
6
+ from beni.bfunc import syncCall
7
+ from typer import Argument, Option
8
+
9
+ app: Final = btask.newSubApp('项目相关')
10
+
11
+
12
+ @app.command()
13
+ @syncCall
14
+ async def init(
15
+ path: Path = Argument(Path.cwd(), help='workspace 路径'),
16
+ deep: int = Option(3, '--deep', '-d', help='探索深度'),
17
+ ):
18
+ '找出项目执行初始化 pnpm install 和 uv sync --all-extras'
19
+
20
+ initSubFolder(path, deep)
21
+
22
+
23
+ def initSubFolder(path: Path, deep: int):
24
+ uvLockFile = path / 'uv.lock'
25
+ pnpmLockFile = path / 'pnpm-lock.yaml'
26
+ if uvLockFile.exists():
27
+ with bpath.changePath(path):
28
+ os.system('uv sync --all-extras')
29
+ elif pnpmLockFile.exists():
30
+ with bpath.changePath(path):
31
+ os.system('pnpm install')
32
+ elif deep > 1:
33
+ for subPath in bpath.listDir(path):
34
+ initSubFolder(subPath, deep - 1)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcmd
3
- Version: 0.6.16
3
+ Version: 0.6.18
4
4
  Summary: Commands for Beni
5
5
  Author-email: Beni Mang <benimang@126.com>
6
6
  Maintainer-email: Beni Mang <benimang@126.com>
@@ -3,7 +3,7 @@ bcmd/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  bcmd/common/func.py,sha256=MehbfuWFHTOsihhYxVFj0_U6-hjMTfLh3n-oMrpyyKo,508
4
4
  bcmd/common/secret.py,sha256=oHZCNnpAjrS3ztuTUy24IwSGeA_3Z8KfgnNP48ZVjrQ,2285
5
5
  bcmd/resources/project/main.py,sha256=xdskz_sf05fYA1SRMFCIxDjx8SnegxTbCmHpW86ItLs,11
6
- bcmd/tasks/__init__.py,sha256=TWpSQfFnPNIcjzPIMHSjtMFvrbuQdq5pIgRv-zC8l6A,335
6
+ bcmd/tasks/__init__.py,sha256=shEJe1E9NlJhVWF0GpRLNDqdCVyJ91WYVKTGc1hrgkw,334
7
7
  bcmd/tasks/bin.py,sha256=DufZGRX7b2zclSaZM-zUPGwOiycN9RsV8KxF8tfSyqs,3240
8
8
  bcmd/tasks/code.py,sha256=IUs_ClZuSsBk2gavlitC8mkRrQQX9rvNDgR8cFxduBA,3992
9
9
  bcmd/tasks/crypto.py,sha256=LKvgsMPLvsi1wlt66TinYiN-oV2IPAfaN9y7hWaVpHs,2951
@@ -15,11 +15,11 @@ bcmd/tasks/lib.py,sha256=AjB_Qx_eZakJQNpo_OQ796RKVNyUAR0m3S-fF9DXF-k,3070
15
15
  bcmd/tasks/math.py,sha256=xbl5UdaDMyAjiLodDPleP4Cutrk2S3NOAgurzAgOEAE,2862
16
16
  bcmd/tasks/mirror.py,sha256=nAe8NYftMKzht16MFBj7RqXwvVhR6Jh2uuAyJLh87og,1098
17
17
  bcmd/tasks/pdf.py,sha256=fkHRgxqzrRxdb4_-9pL9wp2roqAHJPS_dVqAGJvRUsM,1504
18
+ bcmd/tasks/project.py,sha256=q3bK8depPwZoEGqe9fX2ol-DGsLNZgUxrwhVp4PEF68,928
18
19
  bcmd/tasks/proxy.py,sha256=B85ebW_XPo_21j0YKf3oOK-8Crr85ezaPeZZnbnvO4E,1896
19
20
  bcmd/tasks/time.py,sha256=ZiqA1jdgl-TBtFSOxxP51nwv4g9iZItmkFKpf9MKelk,2453
20
21
  bcmd/tasks/upgrade.py,sha256=nyhcl5oGAUnOOR8JJZW2jfepcVJ6O9gufK8VgxUeil0,543
21
22
  bcmd/tasks/wasabi.py,sha256=xWFAxprSIlBqDDMGaNXZFb-SahnW1d_R9XxSKRYIhnM,3110
22
- bcmd/tasks/wslProxy.py,sha256=1i1oyeNzUlmJS0QHv5XQABANiy9i_o-IpE3lymHUBJc,2009
23
23
  bcmd/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
24
24
  bcmd/utils/utils.py,sha256=Oyf5ubxaCD_T2GOz3zJkR4AJzfVcfBqtmL8Gk8_gOJs,202
25
25
  test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -27,8 +27,8 @@ test/conftest.py,sha256=grlPunlsvrkt_8QPckmF4POiKUPVxIxm2TPAh_ZB-zs,405
27
27
  test/test_pdf.py,sha256=7yYlfydyhy2dmVYdTA5Vir2AI8TUdzEi55fL-AqJmio,1533
28
28
  test/test_proxy.py,sha256=UMF2hFFGUEbJR1jT2mO_wdo-7Rfp0NDqIdTRnOmwtjY,164
29
29
  test/test_wasabi.py,sha256=qqXG1Kb9hKH6t624R173j6LagkgmejN0CFYt7kL0nNs,1066
30
- bcmd-0.6.16.dist-info/METADATA,sha256=Kea4dPNNm8Bn-BzR3-4Jt3lAE54x6-j5-62y3N2Ffbo,845
31
- bcmd-0.6.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
32
- bcmd-0.6.16.dist-info/entry_points.txt,sha256=mriCeYh3wksKcqq3-LtzyFkSCIdN1uZc1IJwom-SW1s,34
33
- bcmd-0.6.16.dist-info/top_level.txt,sha256=fYY6tRrJ_G7tn24RXAG0M5ZKbcuaQznodfX1toFPSKs,10
34
- bcmd-0.6.16.dist-info/RECORD,,
30
+ bcmd-0.6.18.dist-info/METADATA,sha256=fvKAuVIOdn77O6R1oPtoimzdcQARuiz2uan0SXfITFk,845
31
+ bcmd-0.6.18.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
32
+ bcmd-0.6.18.dist-info/entry_points.txt,sha256=mriCeYh3wksKcqq3-LtzyFkSCIdN1uZc1IJwom-SW1s,34
33
+ bcmd-0.6.18.dist-info/top_level.txt,sha256=fYY6tRrJ_G7tn24RXAG0M5ZKbcuaQznodfX1toFPSKs,10
34
+ bcmd-0.6.18.dist-info/RECORD,,
bcmd/tasks/wslProxy.py DELETED
@@ -1,59 +0,0 @@
1
- from typing import Final
2
-
3
- import pyperclip
4
- import typer
5
- from beni import bcolor, btask
6
- from beni.bfunc import syncCall, textToAry
7
-
8
- app: Final = btask.newSubApp('WSL2 代理服务')
9
-
10
-
11
- @app.command()
12
- @syncCall
13
- async def linux(
14
- port: int = typer.Argument(15236, help="代理服务器端口"),
15
- ):
16
- '生成终端设置代理服务器的命令'
17
- ip = "$(ip route | grep default | awk '{print $3}')"
18
- lineAry = textToAry(f'''
19
- export HTTP_PROXY=http://{ip}:{port}
20
- export HTTPS_PROXY=http://{ip}:{port}
21
- export ALL_PROXY=http://{ip}:{port}
22
- curl https://google.com.hk
23
- ''')
24
- msg = '\r\n' + '\n'.join(lineAry) + '\n'
25
- pyperclip.copy(msg.strip() + '\n')
26
- bcolor.printMagenta(msg)
27
- bcolor.printYellow('已复制,可直接粘贴使用')
28
-
29
-
30
- @app.command()
31
- @syncCall
32
- async def windows(
33
- port: int = typer.Argument(15236, help="代理服务器端口"),
34
- off: bool = typer.Option(False, '--off', help='关闭代理'),
35
- ):
36
- '设置防火墙以及端口转发'
37
-
38
- firewallName = 'Allow Veee from WSL'
39
-
40
- if not off:
41
- template = f'''
42
- New-NetFirewallRule -DisplayName "{firewallName}" -Direction Inbound -Action Allow -Protocol TCP -LocalPort {port} -RemoteAddress 172.0.0.0/8 -Profile Any
43
- netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport={port} connectaddress=127.0.0.1 connectport={port}
44
- netstat -ano | findstr :{port} | findstr 0.0.0.0
45
- '''
46
- else:
47
- template = f'''
48
- netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport={port}
49
- Remove-NetFirewallRule -DisplayName "{firewallName}"
50
- '''
51
- lineAry = textToAry(template)
52
- msg = '\r\n' + '\n'.join(lineAry) + '\n'
53
- pyperclip.copy(msg.strip() + '\n')
54
- bcolor.printMagenta(msg)
55
- if not off:
56
- bcolor.printYellow('开启防火墙以及端口转发')
57
- else:
58
- bcolor.printYellow('关闭防火墙以及端口转发')
59
- bcolor.printYellow('已复制,可直接粘贴使用')
File without changes