shellscripts 0.25.0__tar.gz → 0.25.1__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.
Files changed (63) hide show
  1. {shellscripts-0.25.0/src/shellscripts.egg-info → shellscripts-0.25.1}/PKG-INFO +15 -2
  2. {shellscripts-0.25.0 → shellscripts-0.25.1}/README.md +14 -1
  3. {shellscripts-0.25.0 → shellscripts-0.25.1}/pyproject.toml +1 -1
  4. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/__init__.py +1 -1
  5. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/config.py +2 -2
  6. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/core.py +37 -12
  7. {shellscripts-0.25.0 → shellscripts-0.25.1/src/shellscripts.egg-info}/PKG-INFO +15 -2
  8. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_014_pypi_version_source.py +171 -11
  9. {shellscripts-0.25.0 → shellscripts-0.25.1}/LICENSE +0 -0
  10. {shellscripts-0.25.0 → shellscripts-0.25.1}/setup.cfg +0 -0
  11. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/__main__.py +0 -0
  12. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/__init__.py +0 -0
  13. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/_dc_common.py +0 -0
  14. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/agy.py +0 -0
  15. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/bin_links.py +0 -0
  16. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/claude.py +0 -0
  17. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/clean.py +0 -0
  18. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/codex.py +0 -0
  19. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/copilot.py +0 -0
  20. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/dicom2jpg.py +0 -0
  21. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/dicomviewer.py +0 -0
  22. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/diff_cmd.py +0 -0
  23. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/doxygen_cmd.py +0 -0
  24. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/edit_cmd.py +0 -0
  25. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/gemini.py +0 -0
  26. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/kiro.py +0 -0
  27. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/opencode.py +0 -0
  28. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/pdf_crop.py +0 -0
  29. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/pdf_merge.py +0 -0
  30. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/pdf_split_by_format.py +0 -0
  31. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/pdf_split_by_toc.py +0 -0
  32. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/pdf_tiler_090.py +0 -0
  33. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/pdf_tiler_100.py +0 -0
  34. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/pdf_toc_clean.py +0 -0
  35. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/pi.py +0 -0
  36. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/req_cmd.py +0 -0
  37. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/tests_cmd.py +0 -0
  38. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/ubuntu_dark_theme.py +0 -0
  39. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/venv_cmd.py +0 -0
  40. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/video2h264.py +0 -0
  41. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/video2h265.py +0 -0
  42. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/view_cmd.py +0 -0
  43. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/vscode_cmd.py +0 -0
  44. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/commands/vsinsider_cmd.py +0 -0
  45. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/utils.py +0 -0
  46. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shell_scripts/version_check.py +0 -0
  47. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shellscripts.egg-info/SOURCES.txt +0 -0
  48. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shellscripts.egg-info/dependency_links.txt +0 -0
  49. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shellscripts.egg-info/entry_points.txt +0 -0
  50. {shellscripts-0.25.0 → shellscripts-0.25.1}/src/shellscripts.egg-info/top_level.txt +0 -0
  51. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_001_002_core.py +0 -0
  52. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_004_bin_links_clean.py +0 -0
  53. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_005_cli_launchers.py +0 -0
  54. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_006_dc_common.py +0 -0
  55. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_007_pdf_commands.py +0 -0
  56. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_008_env_commands.py +0 -0
  57. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_010_req_cmd.py +0 -0
  58. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_011_video_commands.py +0 -0
  59. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_012_workflow_runtime.py +0 -0
  60. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_013_release_pypi_gating.py +0 -0
  61. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_015_pre_release_check.py +0 -0
  62. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_016_release_precheck_gating.py +0 -0
  63. {shellscripts-0.25.0 → shellscripts-0.25.1}/tests/test_tst_017_agy_command.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shellscripts
3
- Version: 0.25.0
3
+ Version: 0.25.1
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.0)
34
+ # s/shellScripts (0.25.1)
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+">
@@ -106,6 +106,12 @@ Upgrade to the latest published PyPI release:
106
106
  s --upgrade
107
107
  ```
108
108
 
109
+ Force a complete re-download and reinstallation by appending the forced-reinstall options (`--force --reinstall --refresh`) to the configured upgrade command:
110
+
111
+ ```bash
112
+ s --upgrade --force
113
+ ```
114
+
109
115
 
110
116
  ### Run Without Installing (uvx)
111
117
 
@@ -145,6 +151,12 @@ s --upgrade --dev
145
151
  s --upgrade --develop
146
152
  ```
147
153
 
154
+ Add `--force` to force a complete re-download and reinstallation of the tagged release:
155
+
156
+ ```bash
157
+ s --upgrade --develop --force
158
+ ```
159
+
148
160
 
149
161
  ## Management Commands
150
162
 
@@ -161,6 +173,7 @@ Built-in management flags:
161
173
  - `--help` : show full help or command help (`shellscripts --help <command>`).
162
174
  - `--version` / `--ver` : print the installed version plus the latest versions available on PyPI and GitHub.
163
175
  - `--upgrade` : run the configured upgrade command automatically on Linux (installs the latest PyPI release by default), otherwise print the manual command.
176
+ - `--upgrade --force` : force download and complete reinstallation by appending `--force --reinstall --refresh` to the `--upgrade` or `--upgrade --dev`/`--upgrade --develop` command.
164
177
  - `--upgrade --dev` / `--upgrade --develop` : upgrade from the latest tagged GitHub release instead of PyPI, regardless of its source branch.
165
178
  - `--uninstall` : run configured uninstall command automatically on Linux, otherwise print the manual command.
166
179
  - `--write-config` : write the default runtime configuration file.
@@ -10,7 +10,7 @@
10
10
  > * **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.
11
11
  > * **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.
12
12
 
13
- # s/shellScripts (0.25.0)
13
+ # s/shellScripts (0.25.1)
14
14
 
15
15
  <p align="center">
16
16
  <img src="https://img.shields.io/badge/python-3.11%2B-3776AB?style=flat-square&logo=python&logoColor=white" alt="Python 3.11+">
@@ -85,6 +85,12 @@ Upgrade to the latest published PyPI release:
85
85
  s --upgrade
86
86
  ```
87
87
 
88
+ Force a complete re-download and reinstallation by appending the forced-reinstall options (`--force --reinstall --refresh`) to the configured upgrade command:
89
+
90
+ ```bash
91
+ s --upgrade --force
92
+ ```
93
+
88
94
 
89
95
  ### Run Without Installing (uvx)
90
96
 
@@ -124,6 +130,12 @@ s --upgrade --dev
124
130
  s --upgrade --develop
125
131
  ```
126
132
 
133
+ Add `--force` to force a complete re-download and reinstallation of the tagged release:
134
+
135
+ ```bash
136
+ s --upgrade --develop --force
137
+ ```
138
+
127
139
 
128
140
  ## Management Commands
129
141
 
@@ -140,6 +152,7 @@ Built-in management flags:
140
152
  - `--help` : show full help or command help (`shellscripts --help <command>`).
141
153
  - `--version` / `--ver` : print the installed version plus the latest versions available on PyPI and GitHub.
142
154
  - `--upgrade` : run the configured upgrade command automatically on Linux (installs the latest PyPI release by default), otherwise print the manual command.
155
+ - `--upgrade --force` : force download and complete reinstallation by appending `--force --reinstall --refresh` to the `--upgrade` or `--upgrade --dev`/`--upgrade --develop` command.
143
156
  - `--upgrade --dev` / `--upgrade --develop` : upgrade from the latest tagged GitHub release instead of PyPI, regardless of its source branch.
144
157
  - `--uninstall` : run configured uninstall command automatically on Linux, otherwise print the manual command.
145
158
  - `--write-config` : write the default runtime configuration file.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "shellscripts"
7
- version = "0.25.0"
7
+ version = "0.25.1"
8
8
  description = "Execute useful shell scripts via an uvx-compatible CLI interface."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -1,4 +1,4 @@
1
- __version__ = "0.25.0"
1
+ __version__ = "0.25.1"
2
2
 
3
3
  from .core import main # noqa: F401
4
4
 
@@ -25,9 +25,9 @@ from shell_scripts.utils import print_warn
25
25
  # @satisfies DES-011, DES-012
26
26
  DEFAULT_RUNTIME_CONFIG: dict[str, Any] = {
27
27
  "management": {
28
- "upgrade": "uv tool install shellscripts --force",
28
+ "upgrade": "uv tool install shellscripts",
29
29
  "upgrade_develop": (
30
- "uv tool install shellscripts --force "
30
+ "uv tool install shellscripts "
31
31
  "--from git+https://github.com/Ogekuri/shellScripts.git@{tag}"
32
32
  ),
33
33
  "uninstall": "uv tool uninstall shellscripts",
@@ -3,9 +3,10 @@
3
3
 
4
4
  @details Provides global help rendering, management command execution
5
5
  (`--version`, `--ver`, `--upgrade`, `--uninstall`, `--write-config`,
6
- `--develop`/`--dev` upgrade selector), runtime
7
- configuration bootstrap, and subcommand delegation to lazily imported modules.
8
- @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
6
+ `--develop`/`--dev` upgrade selector, `--force` forced-reinstall selector),
7
+ runtime configuration bootstrap, and subcommand delegation to lazily imported
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
10
  """
10
11
 
11
12
  import sys
@@ -37,6 +38,14 @@ PROGRAM = "shellscripts"
37
38
  # @satisfies REQ-066
38
39
  HELP_COMMAND_COLUMN_WIDTH = 16
39
40
 
41
+ ## @var FORCED_REINSTALL_OPTIONS
42
+ # @brief Option suffix appended to upgrade commands when `--force` is active.
43
+ # @details Standard forced-reinstall options for `uv tool install`: replace
44
+ # the installed tool entry, reinstall the package, and refresh cached remote
45
+ # metadata so the upgrade performs a full re-download and reinstallation.
46
+ # @satisfies REQ-088, REQ-089
47
+ FORCED_REINSTALL_OPTIONS = "--force --reinstall --refresh"
48
+
40
49
  ## @var HELP_SECTION_COMMANDS
41
50
  # @brief Ordered command groups for global help rendering.
42
51
  # @details Defines deterministic section order and command-token order used by
@@ -142,6 +151,10 @@ def print_help(command_name=None):
142
151
  " --dev - With --upgrade: upgrade from the latest GitHub release tag"
143
152
  )
144
153
  print(" instead of PyPI (alias: --develop).")
154
+ print(
155
+ " --force - With --upgrade: force download and complete reinstallation"
156
+ )
157
+ print(" (appends --force --reinstall --refresh).")
145
158
  print(
146
159
  f" --uninstall - Uninstall {PROGRAM} on Linux; print manual command elsewhere."
147
160
  )
@@ -181,18 +194,21 @@ def _build_develop_upgrade_command(latest_tag: str) -> str:
181
194
  return template.replace("{tag}", latest_tag)
182
195
 
183
196
 
184
- def do_upgrade(develop: bool = False) -> int:
197
+ def do_upgrade(develop: bool = False, force: bool = False) -> int:
185
198
  """@brief Execute Linux-only upgrade command resolved from runtime config.
186
199
 
187
200
  @details Reads management command string from runtime config key
188
201
  `management.upgrade` (PyPI default) or, when `develop` is set, resolves
189
202
  the latest GitHub release tag and composes the tag-pinned upgrade command;
190
- executes it on Linux via shell invocation and prints the manual fallback
191
- command on non-Linux systems.
192
- @param develop {bool} Force upgrade from the latest GitHub release tag.
203
+ appends ` --force --reinstall --refresh` to the resolved command when
204
+ `force` is set; executes the composed command on Linux via shell
205
+ invocation and prints the manual fallback command on non-Linux systems.
206
+ Complexity O(n) over the composed command string length.
207
+ @param develop {bool} Select upgrade from the latest GitHub release tag.
208
+ @param force {bool} Append forced-reinstall options to the upgrade command.
193
209
  @return {int} `1` when develop tag resolution fails; subprocess return code
194
210
  on Linux; `0` on non-Linux fallback.
195
- @satisfies REQ-004, REQ-076, REQ-078, REQ-045, REQ-056
211
+ @satisfies REQ-004, REQ-076, REQ-078, REQ-087, REQ-088, REQ-089, REQ-045, REQ-056
196
212
  """
197
213
 
198
214
  if develop:
@@ -204,6 +220,8 @@ def do_upgrade(develop: bool = False) -> int:
204
220
  install_cmd = _build_develop_upgrade_command(latest_tag)
205
221
  else:
206
222
  install_cmd = get_management_command("upgrade")
223
+ if force:
224
+ install_cmd = f"{install_cmd} {FORCED_REINSTALL_OPTIONS}"
207
225
  if is_linux():
208
226
  require_shell_command_executables(install_cmd)
209
227
  print(f"Upgrading {PROGRAM}...")
@@ -261,12 +279,14 @@ def main():
261
279
  @details Performs runtime OS detection, update check, runtime configuration
262
280
  load, and argument dispatch through management flags (`--version` prints
263
281
  installed plus PyPI/GitHub latest versions; `--upgrade` upgrades from PyPI
264
- or, with `--develop`/`--dev`, from the latest GitHub release tag) and
265
- subcommands, then restores terminal raw/cbreak and disables legacy+xterm
282
+ or, with `--develop`/`--dev`, from the latest GitHub release tag; `--force`
283
+ appends forced-reinstall options to the selected upgrade command; bare
284
+ `--develop`/`--dev`/`--force` selectors are rejected) and subcommands,
285
+ then restores terminal raw/cbreak and disables legacy+xterm
266
286
  mouse-tracking modes (`?9l`, `?1000l`, `?1001l`, `?1002l`, `?1003l`,
267
287
  `?1004l`, `?1005l`, `?1006l`, `?1007l`, `?1015l`, `?1016l`) before exit.
268
288
  @return {int} Process-compatible return code for caller (`sys.exit`).
269
- @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
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
270
290
  """
271
291
  saved_tty = capture_terminal_state()
272
292
  try:
@@ -289,12 +309,17 @@ def main():
289
309
 
290
310
  if first_arg == "--upgrade":
291
311
  develop = any(arg in ("--develop", "--dev") for arg in args[1:])
292
- return do_upgrade(develop=develop)
312
+ force = "--force" in args[1:]
313
+ return do_upgrade(develop=develop, force=force)
293
314
 
294
315
  if first_arg in ("--develop", "--dev"):
295
316
  print_error("--develop/--dev must be used together with --upgrade.")
296
317
  return 1
297
318
 
319
+ if first_arg == "--force":
320
+ print_error("--force must be used together with --upgrade.")
321
+ return 1
322
+
298
323
  if first_arg == "--uninstall":
299
324
  return do_uninstall()
300
325
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shellscripts
3
- Version: 0.25.0
3
+ Version: 0.25.1
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.0)
34
+ # s/shellScripts (0.25.1)
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+">
@@ -106,6 +106,12 @@ Upgrade to the latest published PyPI release:
106
106
  s --upgrade
107
107
  ```
108
108
 
109
+ Force a complete re-download and reinstallation by appending the forced-reinstall options (`--force --reinstall --refresh`) to the configured upgrade command:
110
+
111
+ ```bash
112
+ s --upgrade --force
113
+ ```
114
+
109
115
 
110
116
  ### Run Without Installing (uvx)
111
117
 
@@ -145,6 +151,12 @@ s --upgrade --dev
145
151
  s --upgrade --develop
146
152
  ```
147
153
 
154
+ Add `--force` to force a complete re-download and reinstallation of the tagged release:
155
+
156
+ ```bash
157
+ s --upgrade --develop --force
158
+ ```
159
+
148
160
 
149
161
  ## Management Commands
150
162
 
@@ -161,6 +173,7 @@ Built-in management flags:
161
173
  - `--help` : show full help or command help (`shellscripts --help <command>`).
162
174
  - `--version` / `--ver` : print the installed version plus the latest versions available on PyPI and GitHub.
163
175
  - `--upgrade` : run the configured upgrade command automatically on Linux (installs the latest PyPI release by default), otherwise print the manual command.
176
+ - `--upgrade --force` : force download and complete reinstallation by appending `--force --reinstall --refresh` to the `--upgrade` or `--upgrade --dev`/`--upgrade --develop` command.
164
177
  - `--upgrade --dev` / `--upgrade --develop` : upgrade from the latest tagged GitHub release instead of PyPI, regardless of its source branch.
165
178
  - `--uninstall` : run configured uninstall command automatically on Linux, otherwise print the manual command.
166
179
  - `--write-config` : write the default runtime configuration file.
@@ -1,14 +1,16 @@
1
1
  """
2
- @brief Validate PyPI-primary version sourcing, version reporting, and develop upgrade flows.
2
+ @brief Validate PyPI-primary version sourcing, version reporting, and upgrade flows.
3
3
  @details Verifies startup update checks against the PyPI JSON API, GitHub
4
4
  latest-release resolution, the three-line `--version` report, the PyPI
5
- default upgrade command, the `--upgrade --dev`/`--develop` GitHub-tagged
6
- upgrade command, develop-upgrade failure handling, and rejection of the
7
- develop selector without `--upgrade`. All HTTP and subprocess boundaries are
8
- monkeypatched; no real network, filesystem, clock, or randomness access.
5
+ default upgrade command, the forced-reinstall `--force` suffix on PyPI and
6
+ GitHub-tagged upgrade commands, the `--upgrade --dev`/`--develop`
7
+ GitHub-tagged upgrade command, develop-upgrade failure handling, and
8
+ rejection of the develop and force selectors without `--upgrade`. All HTTP
9
+ and subprocess boundaries are monkeypatched; no real network, filesystem,
10
+ clock, or randomness access.
9
11
  Level classification: Level 0 tests exercise single module functions;
10
12
  Level 1 tests exercise `core.main` dispatch with patched boundaries.
11
- @satisfies TST-014, REQ-003, REQ-075, REQ-076, REQ-077, REQ-078, DES-018, DES-019, DES-020
13
+ @satisfies TST-014, REQ-003, REQ-075, REQ-076, REQ-077, REQ-078, REQ-087, REQ-088, REQ-089, REQ-090, DES-018, DES-019, DES-020
12
14
  @return {None} Pytest module scope.
13
15
  """
14
16
 
@@ -349,7 +351,7 @@ def test_do_upgrade_default_resolves_pypi_command(monkeypatch):
349
351
 
350
352
  result = core.do_upgrade()
351
353
 
352
- expected_output = "uv tool install shellscripts --force"
354
+ expected_output = "uv tool install shellscripts"
353
355
  assert result == 0
354
356
  assert observed["shell"] is True
355
357
  assert observed["command"] == expected_output
@@ -363,7 +365,7 @@ def test_do_upgrade_develop_upgrades_from_latest_github_tag(monkeypatch):
363
365
  propagation.
364
366
  @param monkeypatch {pytest.MonkeyPatch} Runtime patch helper.
365
367
  @return {None} Assertions only.
366
- @satisfies TST-014, REQ-076, DES-019
368
+ @satisfies TST-014, REQ-076, REQ-087, DES-019
367
369
  """
368
370
  observed = {}
369
371
 
@@ -395,7 +397,7 @@ def test_do_upgrade_develop_upgrades_from_latest_github_tag(monkeypatch):
395
397
  result = core.do_upgrade(develop=True)
396
398
 
397
399
  expected_output = (
398
- "uv tool install shellscripts --force "
400
+ "uv tool install shellscripts "
399
401
  "--from git+https://github.com/Ogekuri/shellScripts.git@v1.2.3"
400
402
  )
401
403
  assert result == 5
@@ -403,6 +405,97 @@ def test_do_upgrade_develop_upgrades_from_latest_github_tag(monkeypatch):
403
405
  assert observed["command"] == expected_output
404
406
 
405
407
 
408
+ def test_do_upgrade_force_appends_reinstall_options(monkeypatch):
409
+ """
410
+ @brief Validate the forced PyPI upgrade command contract.
411
+ @details Forces the Linux path, keeps the real runtime-config resolution,
412
+ and intercepts subprocess invocation to assert that `force=True` appends
413
+ the forced-reinstall option suffix to the default PyPI command.
414
+ @param monkeypatch {pytest.MonkeyPatch} Runtime patch helper.
415
+ @return {None} Assertions only.
416
+ @satisfies TST-014, REQ-088
417
+ """
418
+ observed = {}
419
+
420
+ def _fake_run(command, shell=False):
421
+ """
422
+ @brief Mock subprocess.run for the upgrade path.
423
+ @param command {str} Shell command string.
424
+ @param shell {bool} Shell execution selector.
425
+ @return {types.SimpleNamespace} Object with returncode field.
426
+ """
427
+ observed["command"] = command
428
+ observed["shell"] = shell
429
+ return types.SimpleNamespace(returncode=0)
430
+
431
+ monkeypatch.setattr(core, "is_linux", lambda: True)
432
+ monkeypatch.setattr(
433
+ core, "require_shell_command_executables", lambda command: None
434
+ )
435
+ monkeypatch.setattr(
436
+ core,
437
+ "get_management_command",
438
+ lambda name: get_default_runtime_config()["management"][name],
439
+ )
440
+ monkeypatch.setattr(core.subprocess, "run", _fake_run)
441
+
442
+ result = core.do_upgrade(force=True)
443
+
444
+ expected_output = "uv tool install shellscripts --force --reinstall --refresh"
445
+ assert result == 0
446
+ assert observed["shell"] is True
447
+ assert observed["command"] == expected_output
448
+
449
+
450
+ def test_do_upgrade_develop_force_appends_reinstall_options(monkeypatch):
451
+ """
452
+ @brief Validate the forced develop upgrade command contract.
453
+ @details Patches the latest-tag resolution and intercepts subprocess
454
+ invocation to assert that `develop=True, force=True` composes the
455
+ tag-pinned GitHub install command with the forced-reinstall suffix.
456
+ @param monkeypatch {pytest.MonkeyPatch} Runtime patch helper.
457
+ @return {None} Assertions only.
458
+ @satisfies TST-014, REQ-089
459
+ """
460
+ observed = {}
461
+
462
+ def _fake_run(command, shell=False):
463
+ """
464
+ @brief Mock subprocess.run for the upgrade path.
465
+ @param command {str} Shell command string.
466
+ @param shell {bool} Shell execution selector.
467
+ @return {types.SimpleNamespace} Object with returncode field.
468
+ """
469
+ observed["command"] = command
470
+ observed["shell"] = shell
471
+ return types.SimpleNamespace(returncode=5)
472
+
473
+ monkeypatch.setattr(core, "is_linux", lambda: True)
474
+ monkeypatch.setattr(
475
+ core, "require_shell_command_executables", lambda command: None
476
+ )
477
+ monkeypatch.setattr(
478
+ core,
479
+ "get_management_command",
480
+ lambda name: get_default_runtime_config()["management"][name],
481
+ )
482
+ monkeypatch.setattr(
483
+ core, "fetch_github_latest_release", lambda _version: "v1.2.3"
484
+ )
485
+ monkeypatch.setattr(core.subprocess, "run", _fake_run)
486
+
487
+ result = core.do_upgrade(develop=True, force=True)
488
+
489
+ expected_output = (
490
+ "uv tool install shellscripts "
491
+ "--from git+https://github.com/Ogekuri/shellScripts.git@v1.2.3 "
492
+ "--force --reinstall --refresh"
493
+ )
494
+ assert result == 5
495
+ assert observed["shell"] is True
496
+ assert observed["command"] == expected_output
497
+
498
+
406
499
  def test_do_upgrade_develop_fails_when_tag_resolution_fails(
407
500
  monkeypatch,
408
501
  capsys,
@@ -481,10 +574,11 @@ def test_main_upgrade_accepts_develop_aliases(monkeypatch):
481
574
  """
482
575
  observed_calls = []
483
576
 
484
- def _record_upgrade(develop=False):
577
+ def _record_upgrade(develop=False, force=False):
485
578
  """
486
- @brief Record develop selector values.
579
+ @brief Record upgrade selector values.
487
580
  @param develop {bool} Develop selector flag.
581
+ @param force {bool} Forced-reinstall selector flag.
488
582
  @return {int} Deterministic success code.
489
583
  """
490
584
  observed_calls.append(develop)
@@ -503,3 +597,69 @@ def test_main_upgrade_accepts_develop_aliases(monkeypatch):
503
597
 
504
598
  expected_output = [True, True]
505
599
  assert observed_calls == expected_output
600
+
601
+
602
+ def test_main_upgrade_forwards_force_selector(monkeypatch):
603
+ """
604
+ @brief Validate forwarding of the force selector on the upgrade flag.
605
+ @details Replaces `do_upgrade` with a recorder and asserts the develop and
606
+ force selector pairs for plain, forced, forced-develop, and forced-alias
607
+ invocations.
608
+ @param monkeypatch {pytest.MonkeyPatch} Runtime patch helper.
609
+ @return {None} Assertions only.
610
+ @satisfies TST-014, REQ-088, REQ-089
611
+ """
612
+ observed_calls = []
613
+
614
+ def _record_upgrade(develop=False, force=False):
615
+ """
616
+ @brief Record upgrade selector values.
617
+ @param develop {bool} Develop selector flag.
618
+ @param force {bool} Forced-reinstall selector flag.
619
+ @return {int} Deterministic success code.
620
+ """
621
+ observed_calls.append((develop, force))
622
+ return 0
623
+
624
+ monkeypatch.setattr(core, "check_for_updates", lambda _version: None)
625
+ monkeypatch.setattr(core, "print_remote_latest_versions", lambda _version: None)
626
+ monkeypatch.setattr(core, "do_upgrade", _record_upgrade)
627
+
628
+ for argv_tail in (
629
+ ("--upgrade",),
630
+ ("--upgrade", "--force"),
631
+ ("--upgrade", "--develop", "--force"),
632
+ ("--upgrade", "--force", "--dev"),
633
+ ):
634
+ monkeypatch.setattr(core.sys, "argv", ["shellscripts", *argv_tail])
635
+ result = core.main()
636
+ assert result == 0
637
+
638
+ expected_output = [
639
+ (False, False),
640
+ (False, True),
641
+ (True, True),
642
+ (True, True),
643
+ ]
644
+ assert observed_calls == expected_output
645
+
646
+
647
+ def test_main_rejects_force_flag_without_upgrade(monkeypatch, capsys):
648
+ """
649
+ @brief Validate rejection of the bare force selector flag.
650
+ @details Injects `--force` as first argument and asserts return code `1`
651
+ plus an explanatory error line without upgrade execution.
652
+ @param monkeypatch {pytest.MonkeyPatch} Runtime patch helper.
653
+ @param capsys {pytest.CaptureFixture[str]} Stdout/stderr capture helper.
654
+ @return {None} Assertions only.
655
+ @satisfies TST-014, REQ-090
656
+ """
657
+ monkeypatch.setattr(core, "check_for_updates", lambda _version: None)
658
+ monkeypatch.setattr(core, "print_remote_latest_versions", lambda _version: None)
659
+
660
+ monkeypatch.setattr(core.sys, "argv", ["shellscripts", "--force"])
661
+ result = core.main()
662
+ captured = capsys.readouterr()
663
+
664
+ assert result == 1
665
+ assert "--force must be used together with --upgrade" in captured.err
File without changes
File without changes