Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions docs/source/codemods_tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,18 @@ replaces any string which matches our string command-line argument with a consta
It also takes care of adding the import required for the constant to be defined properly.

Cool! Let's look at the command-line help for this codemod. Let's assume you saved it
as ``constant_folding.py`` inside ``libcst.codemod.commands``. You can get help for the
as ``constant_folding.py``. You can get help for the
codemod by running the following command::

python3 -m libcst.tool codemod constant_folding.ConvertConstantCommand --help
python3 -m libcst.tool codemod -x constant_folding.ConvertConstantCommand --help

Notice that along with the default arguments, the ``--string`` and ``--constant``
arguments are present in the help, and the command-line description has been updated
with the codemod's description string. You'll notice that the codemod also shows up
on ``libcst.tool list``.

And ``-x`` flag allows to load any module as a codemod in addition to the standard ones.

----------------
Testing Codemods
----------------
Expand Down