.. _popy_format:

popy_format
#############

Occasionally, we make changes to the :ref:`script_formats` that render old script files defunct. So that you do not need to rewrite all of your old script files, we provide a tool called :command:`popy_format` that reads in the old-style script file and outputs it with the new format.

.. _popy_format_single_script:

Format a script
==================

Do this by opening a :ref:`open_a_popy_command_prompt` and typing:-

.. code-block:: console

    $ popy_format my_script.pyml
 
which will output a new version of **my_script.pyml** called:-

.. code-block:: console

    my_script.pyml.new
    
You can also edit the script 'inplace' using:-

.. code-block:: console

    $ popy_format -i my_script.pyml
    
This creates a backup file called 'my_script.pyml.old' and updates the format of 'my_script.pyml' directly. See :ref:`popy_format_command_line_options` for other options.
 
The output of :command:`popy_format` may need to be manually edited to obtain desired results (|eg| to change from the default value for newly added options).

As usual, a log file will be created to document the formatting process.

.. _popy_format_multi_scripts:

Format multiple scripts
=============================

Note you can also format all scripts in a directory using:-

.. code-block:: console

    $ popy_format *.pyml

This formats all files with the '.pyml' extension in serial.
 
.. _popy_format_command_line_options:
  
Command line options
======================

.. literalinclude:: /_autogen/tool_help/popy_format_help.inc
    :language: console 
    
    