create-awesome-python-app 0.2.7__py3-none-any.whl → 0.2.9__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.
@@ -1,3 +1,3 @@
1
1
  """Create Awesome Python App CLI."""
2
2
 
3
- __version__ = "0.2.7"
3
+ __version__ = "0.2.9"
@@ -71,6 +71,65 @@ def _preprocess_fixture_argv(argv: list[str] | None = None) -> list[str]:
71
71
  return out
72
72
 
73
73
 
74
+ def _expand_variadic_option(argv: list[str], option: str) -> list[str]:
75
+ """Expand ``--addons a b`` into ``--addons a --addons b`` (CNA Commander parity).
76
+
77
+ Typer's ``list[str]`` Option only accepts one value per flag. Commander uses
78
+ ``--addons [extensions...]``, so users naturally write space-separated lists.
79
+
80
+ When ``project_directory`` comes *after* options and no positional was seen
81
+ yet, peel the final trailing token at EOS back as the directory so that
82
+ ``--addons a --addons b /tmp/app`` does not treat ``/tmp/app`` as an addon.
83
+ """
84
+ out: list[str] = []
85
+ i = 0
86
+ prefix = option + "="
87
+ saw_positional = False
88
+ while i < len(argv):
89
+ arg = argv[i]
90
+ if arg == option:
91
+ i += 1
92
+ values: list[str] = []
93
+ while i < len(argv) and not argv[i].startswith("-"):
94
+ values.append(argv[i])
95
+ i += 1
96
+ ended_at_eos = i >= len(argv)
97
+ trailing: str | None = None
98
+ if ended_at_eos and not saw_positional and len(values) >= 2:
99
+ trailing = values.pop()
100
+ if not values:
101
+ out.append(option)
102
+ else:
103
+ for value in values:
104
+ out.extend([option, value])
105
+ if trailing is not None:
106
+ out.append(trailing)
107
+ saw_positional = True
108
+ continue
109
+ if arg.startswith(prefix):
110
+ value = arg[len(prefix) :]
111
+ out.extend([option, value] if value else [option])
112
+ i += 1
113
+ continue
114
+ if i > 0 and not arg.startswith("-"):
115
+ saw_positional = True
116
+ out.append(arg)
117
+ i += 1
118
+ return out
119
+
120
+
121
+ def _preprocess_cli_argv(argv: list[str] | None = None) -> list[str]:
122
+ """Apply argv rewrites needed before Typer parses the CLI."""
123
+ raw = list(sys.argv if argv is None else argv)
124
+ # Pass an explicit list so fixture preprocess does not mutate sys.argv early.
125
+ out = _preprocess_fixture_argv(raw)
126
+ out = _expand_variadic_option(out, "--addons")
127
+ out = _expand_variadic_option(out, "--extend")
128
+ if argv is None:
129
+ sys.argv = out
130
+ return out
131
+
132
+
74
133
  def apply_fixture_mode(fixture: str | None) -> None:
75
134
  """Translate ``--fixture`` into ``CPA_CATALOG_FIXTURE`` / ``CPA_FIXTURE_DIR``."""
76
135
  if fixture is None and os.environ.get("CPA_CATALOG_FIXTURE") != "1":
@@ -204,7 +263,7 @@ def main() -> None:
204
263
  treat `cache` as project_directory).
205
264
  """
206
265
  check_python_version(">=3.12", "create-awesome-python-app")
207
- _preprocess_fixture_argv()
266
+ _preprocess_cli_argv()
208
267
  if len(sys.argv) > 1 and sys.argv[1] == "cache":
209
268
  sys.argv = [sys.argv[0], *sys.argv[2:]]
210
269
  cache_app(prog_name="create-awesome-python-app cache")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: create-awesome-python-app
3
- Version: 0.2.7
3
+ Version: 0.2.9
4
4
  Summary: Composable scaffolding CLI for production-ready Python apps
5
5
  Project-URL: Homepage, https://github.com/Create-Python-App/create-python-app
6
6
  Project-URL: Repository, https://github.com/Create-Python-App/create-python-app
@@ -0,0 +1,9 @@
1
+ create_awesome_python_app/__init__.py,sha256=yEN7GhPafrsxl2sDdfgv5qrUMWqgtvEaeDMa_A0Q8js,60
2
+ create_awesome_python_app/cache.py,sha256=eHKUlunGexZKYJo0HDNoBoOVq0DjLyRYgEe_wUh4Fk0,11812
3
+ create_awesome_python_app/catalog.py,sha256=ZB-ieyEn_TBqVBbCbFkK9h3VJoYtifvvOxs_BM2tDEw,22754
4
+ create_awesome_python_app/cli.py,sha256=FrPDSJIWhSaFvRFFGSSBWJV_8cSvOkuk-yb-JUWi58Q,28338
5
+ create_awesome_python_app/prompt_style.py,sha256=pERX1qPQSLZXeJvPVFC7z85dvte73ZV4iuENPQduheE,3463
6
+ create_awesome_python_app-0.2.9.dist-info/METADATA,sha256=O-jxygHlhVCsJWbJs6ptV7dmWQ-OuTwt9mTXNbeX6qQ,23271
7
+ create_awesome_python_app-0.2.9.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
8
+ create_awesome_python_app-0.2.9.dist-info/entry_points.txt,sha256=rszFbUjY-lvMDZ96zX1lALJwgD1mI3CkUuNyF2qqjYo,81
9
+ create_awesome_python_app-0.2.9.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- create_awesome_python_app/__init__.py,sha256=ePecLVnfNi_mPoF_Pogp9juH5iycJGewOy1U0mxuMvM,60
2
- create_awesome_python_app/cache.py,sha256=eHKUlunGexZKYJo0HDNoBoOVq0DjLyRYgEe_wUh4Fk0,11812
3
- create_awesome_python_app/catalog.py,sha256=ZB-ieyEn_TBqVBbCbFkK9h3VJoYtifvvOxs_BM2tDEw,22754
4
- create_awesome_python_app/cli.py,sha256=JGdXNAXAXqQ-grQbZOf14Vzii3Qh3eZHt5zRJ-tMIBk,26156
5
- create_awesome_python_app/prompt_style.py,sha256=pERX1qPQSLZXeJvPVFC7z85dvte73ZV4iuENPQduheE,3463
6
- create_awesome_python_app-0.2.7.dist-info/METADATA,sha256=gpy3o2dcc-Qw_l1uHnipFJ-IkOUe9GT50bKeGtEqkUc,23271
7
- create_awesome_python_app-0.2.7.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
8
- create_awesome_python_app-0.2.7.dist-info/entry_points.txt,sha256=rszFbUjY-lvMDZ96zX1lALJwgD1mI3CkUuNyF2qqjYo,81
9
- create_awesome_python_app-0.2.7.dist-info/RECORD,,