Files
odoo_source/openerpcommand/conf.py
T
Vo Minh Thu 3da57500c2 [ADD] oe: provides sane (unfucked) command-line interface.
The implementation is far from perfect. Some improvements are waiting in
its previous location: lp:~openerp/openerp-command.

Some docs are provided, see doc/openerp-command.rst and
doc/adding-command.rst.

bzr revid: vmt@openerp.com-20130111134657-im2f3uqjluyo4pm6
2013-01-11 14:46:57 +01:00

26 lines
842 B
Python

"""
Display the currently used configuration. The configuration for any
sub-command is normally given by options. But some options can be specified
using environment variables. This sub-command shows those variables.
A `set` sub-command should be provided when the configuration is in a real
configuration file instead of environment variables.
"""
import os
import sys
import textwrap
def run(args):
for x in ('database', 'addons', 'host', 'port'):
x_ = ('openerp_' + x).upper()
if x_ in os.environ:
print '%s: %s' % (x, os.environ[x_])
else:
print '%s: <not set>' % (x, )
os.environ['OPENERP_DATABASE'] = 'yeah'
def add_parser(subparsers):
parser = subparsers.add_parser('conf',
description='Display the currently used configuration.')
parser.set_defaults(run=run)