zt-devops-cli 0.1.7__tar.gz → 0.1.8__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zt-devops-cli
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: DevOps 平台迭代管理 CLI
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "zt-devops-cli"
7
- version = "0.1.7"
7
+ version = "0.1.8"
8
8
  description = "DevOps 平台迭代管理 CLI"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -89,12 +89,12 @@ def open_login_page(page) -> bool:
89
89
 
90
90
  return False
91
91
 
92
- def get_cookies_from_browser() -> dict:
92
+ def get_cookies_from_browser(headless) -> dict:
93
93
  """通过 Playwright 从浏览器获取 cookie"""
94
94
  print("正在启动浏览器(无头模式),请登录...")
95
95
 
96
96
  with sync_playwright() as p:
97
- browser = p.chromium.launch(headless=True)
97
+ browser = p.chromium.launch(headless=headless)
98
98
  context = browser.new_context()
99
99
  page = context.new_page()
100
100
 
@@ -156,10 +156,10 @@ def get_cookies_from_browser() -> dict:
156
156
 
157
157
  return cookie_dict
158
158
 
159
- def login() -> dict:
159
+ def login(headless) -> dict:
160
160
  """手动登录 - 强制打开浏览器重新获取 cookie"""
161
161
  print("正在启动浏览器(无头模式),请重新登录...")
162
- cookies = get_cookies_from_browser()
162
+ cookies = get_cookies_from_browser(headless)
163
163
  save_cookies(cookies)
164
164
  print("登录成功,cookie 已缓存!")
165
165
  return cookies
@@ -102,10 +102,14 @@ def cli(ctx, project, output_format):
102
102
 
103
103
 
104
104
  @cli.command("login")
105
- def cmd_login():
106
- """登录 - 打开浏览器重新获取 cookie"""
107
- login()
108
-
105
+ @click.option(
106
+ "--headed",
107
+ is_flag=True,
108
+ help="显示浏览器窗口,用于无环境变量时的手动登录",
109
+ )
110
+ def cmd_login(headed):
111
+ """登录 - 打开浏览器重新获取 cookie(默认无头;需手动登录时请传 --headed)"""
112
+ login(headless=not headed)
109
113
 
110
114
  @cli.group()
111
115
  def sprint():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zt-devops-cli
3
- Version: 0.1.7
3
+ Version: 0.1.8
4
4
  Summary: DevOps 平台迭代管理 CLI
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
File without changes
File without changes