Skip to content

Commit

Permalink
pw_module: Experimental module creation command
Browse files Browse the repository at this point in the history
This starts a pw command which can be used to create new modules with
all of the required boilerplate files, simplifying the process of
starting a module.

Initially, the command only has basic support for C++-based modules.
Many of its features are still experimental, and only upstream use is
supported.

Change-Id: I6af9abf8db8833e4fddf7b13bd5220c1cef9448e
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/103611
Reviewed-by: Anthony DiGirolamo <tonymd@google.com>
Commit-Queue: Alexei Frolov <frolv@google.com>
  • Loading branch information
frolv authored and CQ Bot Account committed Sep 22, 2022
1 parent a81ed74 commit 732a16f
Show file tree
Hide file tree
Showing 4 changed files with 890 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pw_module/docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,18 @@ its own lint:
20191205 17:05:19 ERR FAIL: Found errors when checking module pw_module
.. _module-pw_module-module-create:

``pw module create``
^^^^^^^^^^^^^^^^^^^^
The ``pw module create`` command is used to generate all of the required
boilerplate for a new Pigweed module.

.. note::

``pw module create`` is still under construction and mostly experimental.
It is only usable in upstream Pigweed, and has limited feature support, with
a command-line API subject to change.

Once the command is more stable, it will be properly documented. For now,
running ``pw module create --help`` will display the current set of options.
2 changes: 2 additions & 0 deletions pw_module/py/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ pw_python_package("py") {
"pw_module/__init__.py",
"pw_module/__main__.py",
"pw_module/check.py",
"pw_module/create.py",
]
python_deps = [ "$dir_pw_build/py" ]
tests = [ "check_test.py" ]
pylintrc = "$dir_pigweed/.pylintrc"
}
3 changes: 3 additions & 0 deletions pw_module/py/pw_module/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import argparse

import pw_module.check
import pw_module.create


def main() -> None:
Expand All @@ -28,6 +29,8 @@ def main() -> None:

pw_module.check.register_subcommand(
subparsers.add_parser('check', help=pw_module.check.__doc__))
pw_module.create.register_subcommand(
subparsers.add_parser('create', help=pw_module.create.__doc__))

args = {**vars(parser.parse_args())}
func = args['func']
Expand Down
Loading

0 comments on commit 732a16f

Please sign in to comment.