.. -*- coding: utf-8 -*-

.. _command-line-run:

====================================
Running PyBill with the command-line
====================================

**PyBill** can only be run from the command-line with ``pybill`` executable 
file. The usage of this command is:

.. sourcecode:: bash

    pybill [options] accounting-files

``accounting-files`` is a list of files in PBD XML format. These files will be
transformed in PDF by PyBill. Each PDF file is saved in the same directory as
its corresponding PBD XML file. Several options control the PDF transformation:

``-c`` or ``--config``
    option used to specify a configuration file. This file must be in PyBill
    configuration format. It will override any configuration file that is
    specified in the accounting-files thanks to a processing instruction.

``-k`` or ``--config``
    option used to ask the automatic conversion of the accounting files into the
    last PBD format. The existing files are saved with a ``.old`` extension and
    are replaced with files containing the converted accounting documents.

    Please note that files that already are in the last PBD format will also
    be converted.

``-n`` or ``--no-entries`` 
    option to disable the generation of the accounting entries. By default,
    PyBill generates the accounting entries in ``pycompta`` XML format for the
    accounting documents it processes (in each document, a dedicated processing
    instruction can contain the number of the accounts impacted by the
    document). The entries are saved in the XML file specified by ``-e`` 
    option.

``-e`` or ``--entries-file``
    option to specify the name of the XML file in which the accounting entries
    generated by PyBill from the accounting documents it processes, will be
    saved. By default, this file name is ``entries.xml``.

Some general options can also be used:

``--version``
    option for printing PyBill version and exiting without doing anything more.

``-h`` or ``--help``
    option for printing PyBill help message and exiting without doing anything 
    more.

``-d`` or ``--debug``
    option for always stopping in case of exception and for writing the full
    exception message.
