shellscripts 0.25.1__py3-none-any.whl → 0.25.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.
shell_scripts/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "0.25.1"
1
+ __version__ = "0.25.2"
2
2
 
3
3
  from .core import main # noqa: F401
4
4
 
shell_scripts/core.py CHANGED
@@ -6,7 +6,7 @@
6
6
  `--develop`/`--dev` upgrade selector, `--force` forced-reinstall selector),
7
7
  runtime configuration bootstrap, and subcommand delegation to lazily imported
8
8
  modules.
9
- @satisfies PRJ-001, PRJ-002, PRJ-003, REQ-001, REQ-002, REQ-003, REQ-004, REQ-005, REQ-045, REQ-046, REQ-048, REQ-049, REQ-050, REQ-051, REQ-052, REQ-053, REQ-054, REQ-056, REQ-064, REQ-065, REQ-066, REQ-068, REQ-069, REQ-075, REQ-076, REQ-077, REQ-078, REQ-087, REQ-088, REQ-089, REQ-090
9
+ @satisfies PRJ-001, PRJ-002, PRJ-003, REQ-001, REQ-002, REQ-003, REQ-004, REQ-005, REQ-045, REQ-046, REQ-048, REQ-049, REQ-050, REQ-051, REQ-052, REQ-053, REQ-054, REQ-056, REQ-064, REQ-065, REQ-066, REQ-068, REQ-069, REQ-075, REQ-076, REQ-077, REQ-078, REQ-087, REQ-088, REQ-089, REQ-090, REQ-091
10
10
  """
11
11
 
12
12
  import sys
@@ -18,7 +18,12 @@ from shell_scripts.config import (
18
18
  load_runtime_config,
19
19
  write_default_runtime_config,
20
20
  )
21
- from shell_scripts.version_check import check_for_updates, fetch_github_latest_release, print_remote_latest_versions
21
+ from shell_scripts.version_check import (
22
+ check_for_updates,
23
+ fetch_github_latest_release,
24
+ format_version_report_line,
25
+ print_remote_latest_versions,
26
+ )
22
27
  from shell_scripts.commands import get_command
23
28
  from shell_scripts.utils import (
24
29
  capture_terminal_state,
@@ -278,7 +283,8 @@ def main():
278
283
 
279
284
  @details Performs runtime OS detection, update check, runtime configuration
280
285
  load, and argument dispatch through management flags (`--version` prints
281
- installed plus PyPI/GitHub latest versions; `--upgrade` upgrades from PyPI
286
+ the aligned three-line report with installed plus PyPI/GitHub latest
287
+ versions; `--upgrade` upgrades from PyPI
282
288
  or, with `--develop`/`--dev`, from the latest GitHub release tag; `--force`
283
289
  appends forced-reinstall options to the selected upgrade command; bare
284
290
  `--develop`/`--dev`/`--force` selectors are rejected) and subcommands,
@@ -286,7 +292,7 @@ def main():
286
292
  mouse-tracking modes (`?9l`, `?1000l`, `?1001l`, `?1002l`, `?1003l`,
287
293
  `?1004l`, `?1005l`, `?1006l`, `?1007l`, `?1015l`, `?1016l`) before exit.
288
294
  @return {int} Process-compatible return code for caller (`sys.exit`).
289
- @satisfies PRJ-001, REQ-001, REQ-002, REQ-003, REQ-004, REQ-005, REQ-045, REQ-046, REQ-047, REQ-048, REQ-049, REQ-050, REQ-051, REQ-052, REQ-053, REQ-054, REQ-064, REQ-065, REQ-066, REQ-068, REQ-069, REQ-075, REQ-076, REQ-077, REQ-078, REQ-087, REQ-088, REQ-089, REQ-090
295
+ @satisfies PRJ-001, REQ-001, REQ-002, REQ-003, REQ-004, REQ-005, REQ-045, REQ-046, REQ-047, REQ-048, REQ-049, REQ-050, REQ-051, REQ-052, REQ-053, REQ-054, REQ-064, REQ-065, REQ-066, REQ-068, REQ-069, REQ-075, REQ-076, REQ-077, REQ-078, REQ-087, REQ-088, REQ-089, REQ-090, REQ-091
290
296
  """
291
297
  saved_tty = capture_terminal_state()
292
298
  try:
@@ -303,7 +309,7 @@ def main():
303
309
  first_arg = args[0]
304
310
 
305
311
  if first_arg in ("--version", "--ver"):
306
- print(__version__)
312
+ print(format_version_report_line("Current Installed", __version__))
307
313
  print_remote_latest_versions(__version__)
308
314
  return 0
309
315
 
@@ -258,32 +258,61 @@ def fetch_github_latest_release(current_version: str) -> str:
258
258
  return str(payload["tag_name"])
259
259
 
260
260
 
261
+ BRIGHT_GREEN = "\033[92m"
262
+ BRIGHT_RED = "\033[91m"
263
+ RESET = "\033[0m"
264
+
265
+ # @brief Fixed label column width for aligned `--version` report lines.
266
+ # @details Left-justifies every report label (`Current Installed`,
267
+ # `Latest @ PyPI`, `Latest @ GitHub`) before the `: ` value separator so all
268
+ # version tokens start at the same output column.
269
+ # @satisfies REQ-091
270
+ REPORT_LABEL_WIDTH = 18
271
+
272
+
273
+ def format_version_report_line(label: str, value: str) -> str:
274
+ """@brief Render one aligned `--version` report line.
275
+
276
+ @details Left-justifies the report label to `REPORT_LABEL_WIDTH`
277
+ characters, then appends `: ` and the raw value without color codes so
278
+ callers keep control of terminal coloring. Time complexity O(1).
279
+ @param label {str} Report label token (for example `Latest @ PyPI`).
280
+ @param value {str} Report value token (version string or
281
+ `unknown (<reason>)`).
282
+ @return {str} Aligned report line shaped as `<label>: <value>`.
283
+ @satisfies REQ-075, REQ-091
284
+ """
285
+ return f"{label:<{REPORT_LABEL_WIDTH}}: {value}"
286
+
287
+
261
288
  def print_remote_latest_versions(current_version: str) -> None:
262
289
  """@brief Print PyPI and GitHub latest-version report lines.
263
290
 
264
- @details Emits one `<source> latest: <version>` line per remote source in
265
- fixed order (PyPI, GitHub). A failed source lookup prints one bright-red
266
- `<source> latest: unknown (<reason>)` line where `<reason>` is the
267
- `_format_request_error` descriptor of the actual failure, and the remaining
268
- source is still processed. Complexity O(1) excluding network latency.
291
+ @details Emits one aligned `Latest @ <source>` line per remote source in
292
+ fixed order (PyPI, GitHub), left-justifying each label to
293
+ `REPORT_LABEL_WIDTH` characters. A failed source lookup prints one
294
+ bright-red aligned line whose value is `unknown (<reason>)` where
295
+ `<reason>` is the `_format_request_error` descriptor of the actual
296
+ failure, and the remaining source is still processed. Complexity O(1)
297
+ excluding network latency.
269
298
  @param current_version {str} Installed package version used in User-Agent.
270
299
  @return {None} Writes two report or error lines to stdout.
271
- @satisfies REQ-003, REQ-075, REQ-084, DES-020
300
+ @satisfies REQ-003, REQ-075, REQ-084, REQ-091, DES-020
272
301
  """
273
302
 
274
303
  for source_label, fetch_version in (
275
- ("PyPI", fetch_pypi_latest_version),
276
- ("GitHub", fetch_github_latest_release),
304
+ ("Latest @ PyPI", fetch_pypi_latest_version),
305
+ ("Latest @ GitHub", fetch_github_latest_release),
277
306
  ):
278
307
  try:
279
308
  latest_version = fetch_version(current_version).lstrip("v")
280
309
  except Exception as error:
281
- print(
282
- f"{BRIGHT_RED}{source_label} latest: unknown "
283
- f"({_format_request_error(error)}){RESET}"
310
+ failure_line = format_version_report_line(
311
+ source_label, f"unknown ({_format_request_error(error)})"
284
312
  )
313
+ print(f"{BRIGHT_RED}{failure_line}{RESET}")
285
314
  continue
286
- print(f"{source_label} latest: {latest_version}")
315
+ print(format_version_report_line(source_label, latest_version))
287
316
 
288
317
 
289
318
  def check_for_updates(current_version: str) -> None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shellscripts
3
- Version: 0.25.1
3
+ Version: 0.25.2
4
4
  Summary: Execute useful shell scripts via an uvx-compatible CLI interface.
5
5
  Author: Francesco Rolando
6
6
  License-Expression: GPL-3.0-only
@@ -31,7 +31,7 @@ Dynamic: license-file
31
31
  > * **No Support or Feature Requests:** Please **do not** open issues, bug reports, or feature requests. They will not be addressed or accepted at this stage of development.
32
32
  > * **No Warranty:** This software is provided **"AS IS"**, without warranty of any kind, express or implied. You may use it strictly for **testing and evaluation purposes** at your own sole risk.
33
33
 
34
- # s/shellScripts (0.25.1)
34
+ # s/shellScripts (0.25.2)
35
35
 
36
36
  <p align="center">
37
37
  <img src="https://img.shields.io/badge/python-3.11%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.11+">
@@ -1,9 +1,9 @@
1
- shell_scripts/__init__.py,sha256=XWnbBP7_a1CX7d2RbumNzRbD9edw5GSlnaqo-JXSLZs,96
1
+ shell_scripts/__init__.py,sha256=4d-ScPDhq1Rvfc0yRdBd3KfqUeQdNONcCg404wdvb1A,96
2
2
  shell_scripts/__main__.py,sha256=-wEmwKTfeY5TphAH82E38XRPoB4KT5QDLDgRZz84PTs,83
3
3
  shell_scripts/config.py,sha256=bOFq3UxuTHPOqPc7lXLqri7f6NTaF19Mx1Q0i4rY3Dg,12624
4
- shell_scripts/core.py,sha256=_xMg7u-g774Z-BpR00JbUHuRevz-CziutS9SnNlpEXw,12619
4
+ shell_scripts/core.py,sha256=yDEWRoU20W2agzKQVa6P7moOnodAH0_5HAU0YDIlVuI,12774
5
5
  shell_scripts/utils.py,sha256=ckIJRJ_F7XTu_SqpFu_vI_70xNOmVM3S48YiTzxpO7o,14115
6
- shell_scripts/version_check.py,sha256=KVXVksy-T5V6rAYAnWACzv5MHi2dnrsYiNYg_yW0Eks,13184
6
+ shell_scripts/version_check.py,sha256=jW7VUGp0Cv3X8YaxVb91caz4NSABQSKWNRmOeTrEyuw,14386
7
7
  shell_scripts/commands/__init__.py,sha256=VoB5ucIdlUmcVdYV1JNgPvGBJU3aKPZMMMmY20Kjf5E,3682
8
8
  shell_scripts/commands/_dc_common.py,sha256=kfUn92r6n8F1w27jy5QDJE_6Kvpvzhq6dUGNs0_GO0U,4695
9
9
  shell_scripts/commands/agy.py,sha256=L2BFopbNEI40BDrEAs3P6sAJw78U50ZH1SbylkA79hc,2997
@@ -37,9 +37,9 @@ shell_scripts/commands/video2h265.py,sha256=Sr_UWGz_V77x4anmuy8kiWZv5I_AOFlV0WDn
37
37
  shell_scripts/commands/view_cmd.py,sha256=qHEivQHZpZCTE3VSFP1ay2SuqgancQlEKxJcKtyeqNA,1827
38
38
  shell_scripts/commands/vscode_cmd.py,sha256=Rkcjt5A1HMzqJoh2Yz9VRGoLP-L3qpRO5hkcSrzOmvA,1461
39
39
  shell_scripts/commands/vsinsider_cmd.py,sha256=KTTv1cVpJO-u1ktxOE0W_o4AAmz20pAvkDtyhpU9XBg,1548
40
- shellscripts-0.25.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
41
- shellscripts-0.25.1.dist-info/METADATA,sha256=9W8Pw-maYRhZbciK6cQeITC95ocy6QZDsS_aQzI_08E,11279
42
- shellscripts-0.25.1.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
43
- shellscripts-0.25.1.dist-info/entry_points.txt,sha256=9ICAgH87fxHBzi3f6JXIVcsPWzAKsCh4_1xS8JThQ0M,85
44
- shellscripts-0.25.1.dist-info/top_level.txt,sha256=7bDVqjcR5CfCCArCP4X4e9gYJ-ua8z-GfQeHbAo8rCY,14
45
- shellscripts-0.25.1.dist-info/RECORD,,
40
+ shellscripts-0.25.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
41
+ shellscripts-0.25.2.dist-info/METADATA,sha256=sr999r0yDjmxXDLJaaKK5gkaSM7bHTj5QawYdEfvquI,11279
42
+ shellscripts-0.25.2.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
43
+ shellscripts-0.25.2.dist-info/entry_points.txt,sha256=9ICAgH87fxHBzi3f6JXIVcsPWzAKsCh4_1xS8JThQ0M,85
44
+ shellscripts-0.25.2.dist-info/top_level.txt,sha256=7bDVqjcR5CfCCArCP4X4e9gYJ-ua8z-GfQeHbAo8rCY,14
45
+ shellscripts-0.25.2.dist-info/RECORD,,