summaryrefslogtreecommitdiff
path: root/doc/adding-command.rst
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2014-05-30 09:22:12 +0200
committerGéry Debongnie <ged@odoo.com>2014-05-30 09:22:12 +0200
commit6b4a227cd43b6c031356557cc1f4d6cf6cecd0dd (patch)
treefb75d97275c2530863e1c5c7eaa0c7656de1d5df /doc/adding-command.rst
parent6f436a2a0e12f6f7a1469e67e8d02c8e2393c56e (diff)
parent2f4984b8381c6407a720b122733242e6cf3101da (diff)
Merge remote-tracking branch 'odoo/master' into master-inline-searchview-ged
Diffstat (limited to 'doc/adding-command.rst')
-rw-r--r--doc/adding-command.rst34
1 files changed, 0 insertions, 34 deletions
diff --git a/doc/adding-command.rst b/doc/adding-command.rst
deleted file mode 100644
index 5a177b06817..00000000000
--- a/doc/adding-command.rst
+++ /dev/null
@@ -1,34 +0,0 @@
-.. _adding-command:
-
-Adding a new command
-====================
-
-``oe`` uses the argparse_ library to implement commands. Each
-command lives in its own ``openerpcommand/<command>.py`` file.
-
-.. _argparse: http://docs.python.org/2.7/library/argparse.html
-
-To create a new command, probably the most simple way to get started is to
-copy/paste an existing command, say ``openerpcommand/initialize.py`` to
-``openerpcommand/foo.py``. In the newly created file, the important bits
-are the ``run(args)`` and ``add_parser(subparsers)`` functions.
-
-``add_parser``'s responsability is to create a (sub-)parser for the command,
-i.e. describe the different options and flags. The last thing it does is to set
-``run`` as the function to call when the command is invoked.
-
-.. code-block:: python
-
- > def add_parser(subparsers):
- > parser = subparsers.add_parser('<command-name>',
- > description='...')
- > parser.add_argument(...)
- > ...
- > parser.set_defaults(run=run)
-
-``run(args)`` actually implements the command. It should be kept as simple as
-possible and delegate most of its work to small functions (probably placed at
-the top of the new file). In other words, its responsability is mainly to
-deal with the presence/absence/pre-processing of ``argparse``'s arguments.
-
-Finally, the module must be added to ``openerpcommand/__init__.py``.