git-project 0.0.44__tar.gz → 0.1.0__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 (51) hide show
  1. {git_project-0.0.44 → git_project-0.1.0}/PKG-INFO +12 -32
  2. {git_project-0.0.44 → git_project-0.1.0}/_version.py +2 -2
  3. {git_project-0.0.44 → git_project-0.1.0}/docs/changelog.rst +9 -1
  4. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/__init__.py +4 -3
  5. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/parsermanager.py +10 -2
  6. {git_project-0.0.44 → git_project-0.1.0}/tests/test_confobj.py +2 -0
  7. {git_project-0.0.44 → git_project-0.1.0}/tests/test_git.py +2 -0
  8. {git_project-0.0.44 → git_project-0.1.0}/tests/test_parsermanager.py +10 -0
  9. {git_project-0.0.44 → git_project-0.1.0}/.gitignore +0 -0
  10. {git_project-0.0.44 → git_project-0.1.0}/CONTRIBUTORS +0 -0
  11. {git_project-0.0.44 → git_project-0.1.0}/COPYING +0 -0
  12. {git_project-0.0.44 → git_project-0.1.0}/MANIFEST.in +0 -0
  13. {git_project-0.0.44 → git_project-0.1.0}/changelog.d/README.rst +0 -0
  14. {git_project-0.0.44 → git_project-0.1.0}/changelog.py +0 -0
  15. {git_project-0.0.44 → git_project-0.1.0}/docs/Makefile +0 -0
  16. {git_project-0.0.44 → git_project-0.1.0}/docs/api.rst +0 -0
  17. {git_project-0.0.44 → git_project-0.1.0}/docs/authors.rst +0 -0
  18. {git_project-0.0.44 → git_project-0.1.0}/docs/conf.py +0 -0
  19. {git_project-0.0.44 → git_project-0.1.0}/docs/contributing.rst +0 -0
  20. {git_project-0.0.44 → git_project-0.1.0}/docs/index.rst +0 -0
  21. {git_project-0.0.44 → git_project-0.1.0}/docs/intro.rst +0 -0
  22. {git_project-0.0.44 → git_project-0.1.0}/docs/license.rst +0 -0
  23. {git_project-0.0.44 → git_project-0.1.0}/docs/make.bat +0 -0
  24. {git_project-0.0.44 → git_project-0.1.0}/docs/plugins.rst +0 -0
  25. {git_project-0.0.44 → git_project-0.1.0}/pyproject.toml +0 -0
  26. {git_project-0.0.44 → git_project-0.1.0}/requirements.txt +0 -0
  27. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/commandline.py +0 -0
  28. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/configobj.py +0 -0
  29. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/exception.py +0 -0
  30. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/git.py +0 -0
  31. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/gitproject.py +0 -0
  32. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/main.py +0 -0
  33. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/plugin.py +0 -0
  34. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/pluginmanager.py +0 -0
  35. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/project.py +0 -0
  36. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/py.typed +0 -0
  37. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/runnable.py +0 -0
  38. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/scopedobj.py +0 -0
  39. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/shell.py +0 -0
  40. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/substitutable.py +0 -0
  41. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/test_support/__init__.py +0 -0
  42. {git_project-0.0.44 → git_project-0.1.0}/src/git_project/test_support/common.py +0 -0
  43. {git_project-0.0.44 → git_project-0.1.0}/tests/conftest.py +0 -0
  44. {git_project-0.0.44 → git_project-0.1.0}/tests/test_changelog.py +0 -0
  45. {git_project-0.0.44 → git_project-0.1.0}/tests/test_gitproject.py +0 -0
  46. {git_project-0.0.44 → git_project-0.1.0}/tests/test_main.py +0 -0
  47. {git_project-0.0.44 → git_project-0.1.0}/tests/test_project.py +0 -0
  48. {git_project-0.0.44 → git_project-0.1.0}/tests/test_runnable.py +0 -0
  49. {git_project-0.0.44 → git_project-0.1.0}/tests/test_scopedobj.py +0 -0
  50. {git_project-0.0.44 → git_project-0.1.0}/tests/test_shell.py +0 -0
  51. {git_project-0.0.44 → git_project-0.1.0}/tests/test_substitutable.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: git-project
3
- Version: 0.0.44
3
+ Version: 0.1.0
4
4
  Summary: The extensible stupid project manager
5
5
  Author-email: "David A. Greene" <dag@obbligato.org>
6
6
  License-Expression: AGPL-3.0-or-later
@@ -170,9 +170,10 @@ full manual.
170
170
 
171
171
  ``--menu`` lists a command's subcommands, arguments and options in a form meant
172
172
  for tools. ``--menu=json`` prints them as one JSON object and adds each
173
- subcommand's aliases and each argument's ``nargs`` and ``choices``. The
174
- ``version`` field changes only when a key is removed or changes meaning, so a
175
- reader should ignore keys it does not know.
173
+ subcommand's aliases and each argument's ``nargs`` and ``choices``. An option's
174
+ ``name`` is its long flag when it has one. The ``version`` field changes only
175
+ when a key is removed or changes meaning, so a reader should ignore keys it
176
+ does not know.
176
177
 
177
178
  License
178
179
  =======
@@ -217,36 +218,15 @@ Authors
217
218
  .. _David Greene: https://github.com/greened
218
219
 
219
220
 
220
- `0.0.44`_ - 2026-10-13
221
- ----------------------
222
- Added
223
- .....
224
- - ``--menu=json`` prints the menu as one JSON object with a ``version`` field.
225
- Unlike the text form, it lists each subcommand's aliases and each argument's
226
- ``nargs`` and ``choices``.
227
-
221
+ `0.1.0`_ - 2026-10-15
222
+ ---------------------
228
223
  Changed
229
224
  .......
230
- - ``--menu`` takes only ``text`` or ``json``. A command name after it is now an
231
- error, where it used to be ignored. Put ``--menu`` after the command, as in
232
- ``git <project> worktree --menu``.
233
-
234
- Fixed
235
- .....
236
- - Loading a config object no longer writes the values it loaded into the
237
- repository's local config. Every command loads the project this way, so a
238
- single-valued key set in the project's section of the global or system config
239
- was copied into the local config on each run, even by a command that changes
240
- nothing. Removing a key that has no value in the local config no longer fails.
241
- Any value it has in another config file, such as the global or system config,
242
- stays in place.
243
- - ``--menu`` now reports whether an option takes a value from the action
244
- argparse builds for it. An option added with ``action="append"``,
245
- ``action="extend"`` or a custom action class and no ``nargs`` was listed
246
- as taking no value, and one with a custom action and ``nargs=0`` as taking
247
- one.
248
-
249
- .. _Unreleased: https://github.com/greened/git-project/compare/v0.0.44...HEAD
225
+ - ``--menu=json`` names an option by its long flag when it has one, and lists its other flags as aliases, whatever order they were declared in.
226
+ - Versions follow semantic versioning from 0.1.0. Before 1.0.0 a breaking change bumps the minor version, and a feature or a fix bumps the patch. From 1.0.0 on, a breaking change bumps the major version, a feature the minor and a fix the patch. ``--menu=json`` version 1 is part of that contract.
227
+
228
+ .. _Unreleased: https://github.com/greened/git-project/compare/v0.1.0...HEAD
229
+ .. _0.1.0: https://github.com/greened/git-project/compare/v0.0.44...v0.1.0
250
230
  .. _0.0.44: https://github.com/greened/git-project/compare/v0.0.43...v0.0.44
251
231
  .. _0.0.43: https://github.com/greened/git-project/compare/v0.0.42...v0.0.43
252
232
  .. _0.0.42: https://github.com/greened/git-project/compare/v0.0.41...v0.0.42
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '0.0.44'
22
- __version_tuple__ = version_tuple = (0, 0, 44)
21
+ __version__ = version = '0.1.0'
22
+ __version_tuple__ = version_tuple = (0, 1, 0)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -31,6 +31,13 @@ ChangeLog
31
31
  `Unreleased`_
32
32
  -------------
33
33
 
34
+ `0.1.0`_ - 2026-10-15
35
+ ---------------------
36
+ Changed
37
+ .......
38
+ - ``--menu=json`` names an option by its long flag when it has one, and lists its other flags as aliases, whatever order they were declared in.
39
+ - Versions follow semantic versioning from 0.1.0. Before 1.0.0 a breaking change bumps the minor version, and a feature or a fix bumps the patch. From 1.0.0 on, a breaking change bumps the major version, a feature the minor and a fix the patch. ``--menu=json`` version 1 is part of that contract.
40
+
34
41
  `0.0.44`_ - 2026-10-13
35
42
  ----------------------
36
43
  Added
@@ -253,7 +260,8 @@ Fixed
253
260
  ``git_project``. No declared environment supplied Sphinx either, so a
254
261
  ``docs`` environment with Sphinx is now declared.
255
262
 
256
- .. _Unreleased: https://github.com/greened/git-project/compare/v0.0.44...HEAD
263
+ .. _Unreleased: https://github.com/greened/git-project/compare/v0.1.0...HEAD
264
+ .. _0.1.0: https://github.com/greened/git-project/compare/v0.0.44...v0.1.0
257
265
  .. _0.0.44: https://github.com/greened/git-project/compare/v0.0.43...v0.0.44
258
266
  .. _0.0.43: https://github.com/greened/git-project/compare/v0.0.42...v0.0.43
259
267
  .. _0.0.42: https://github.com/greened/git-project/compare/v0.0.41...v0.0.42
@@ -162,9 +162,10 @@ full manual.
162
162
 
163
163
  ``--menu`` lists a command's subcommands, arguments and options in a form meant
164
164
  for tools. ``--menu=json`` prints them as one JSON object and adds each
165
- subcommand's aliases and each argument's ``nargs`` and ``choices``. The
166
- ``version`` field changes only when a key is removed or changes meaning, so a
167
- reader should ignore keys it does not know.
165
+ subcommand's aliases and each argument's ``nargs`` and ``choices``. An option's
166
+ ``name`` is its long flag when it has one. The ``version`` field changes only
167
+ when a key is removed or changes meaning, so a reader should ignore keys it
168
+ does not know.
168
169
 
169
170
  License
170
171
  =======
@@ -111,6 +111,14 @@ class ParserManager:
111
111
  return None
112
112
  return list(map(str, self.choices))
113
113
 
114
+ def menu_names(self):
115
+ # Keys on the long flag regardless of declaration order.
116
+ names = [self.name, *self.aliases]
117
+ long = next((n for n in names if n.startswith("--")), None)
118
+ if long is None:
119
+ return self.name, list(self.aliases)
120
+ return long, [n for n in names if n != long]
121
+
114
122
  def __init__(self, key, parser):
115
123
  """Parser constructor.
116
124
 
@@ -160,8 +168,8 @@ class ParserManager:
160
168
  ],
161
169
  "optionals": [
162
170
  {
163
- "name": optional.name,
164
- "aliases": list(optional.aliases),
171
+ "name": optional.menu_names()[0],
172
+ "aliases": optional.menu_names()[1],
165
173
  "has_value": optional.has_value,
166
174
  "nargs": optional.menu_nargs(),
167
175
  "choices": optional.menu_choices(),
@@ -53,6 +53,8 @@ def check_lines(section, key, value, section_present=True, key_present=True):
53
53
  found_section = True
54
54
  if not key:
55
55
  return True
56
+ elif line.strip().startswith("["):
57
+ break
56
58
  elif key:
57
59
  if line.strip() == f"{key} = {value}":
58
60
  return key_present
@@ -160,6 +160,8 @@ def test_git_config(reset_directory, local_repository):
160
160
  found_section = True
161
161
  if not key:
162
162
  return True
163
+ elif line.strip().startswith("["):
164
+ break
163
165
  elif key:
164
166
  if line.strip() == f"{key} = {value}":
165
167
  if key_present:
@@ -68,6 +68,7 @@ def add_menu_entries(parser_manager):
68
68
  main.add_argument("where", nargs="?", help="Maybe a place")
69
69
  main.add_argument("mode", choices=["fast", "slow"], help="A mode")
70
70
  main.add_argument("--force", "-f", action="store_true", help="Force it")
71
+ main.add_argument("-b", "--branch", help="Short flag first")
71
72
  main.add_argument("--pair", nargs=2, help="Two values")
72
73
 
73
74
 
@@ -115,6 +116,14 @@ def test_menu_json(reset_directory, parser_manager, capsys):
115
116
  "choices": None,
116
117
  "description": "Force it",
117
118
  },
119
+ {
120
+ "name": "--branch",
121
+ "aliases": ["-b"],
122
+ "has_value": True,
123
+ "nargs": None,
124
+ "choices": None,
125
+ "description": "Short flag first",
126
+ },
118
127
  {
119
128
  "name": "--pair",
120
129
  "aliases": [],
@@ -181,6 +190,7 @@ def test_menu_text_unchanged(reset_directory, parser_manager, capsys, args):
181
190
  "mode:A mode\n"
182
191
  "OPTIONALS:\n"
183
192
  "--force:-f:False:Force it\n"
193
+ "-b:--branch:True:Short flag first\n"
184
194
  "--pair::True:Two values\n"
185
195
  )
186
196
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes