From 72701e4b40279c729accdf6d93bb03143337dae2 Mon Sep 17 00:00:00 2001 From: Kirill Ignatev Date: Thu, 4 Jul 2024 02:49:15 -0400 Subject: [PATCH] Mention codemod -x flag in docs (#1169) --- docs/source/codemods_tutorial.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/source/codemods_tutorial.rst b/docs/source/codemods_tutorial.rst index 78365ca9..8fc71bea 100644 --- a/docs/source/codemods_tutorial.rst +++ b/docs/source/codemods_tutorial.rst @@ -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 ----------------