接上回,odoo-bin中调用了odoo.cli.main(),去哪儿找?

cli目录容易找

跟随__init__.py的脚步

 1 import logging
 2 import sys
 3 import os
 4 
 5 import odoo
 6 
 7 from command import Command, main
 8 
 9 import deploy
10 import scaffold
11 import server
12 import shell
13 import start

see line 7

我们发现程序从command中引入了command类?和main函数

then goto command.py

搜索 main()

我们发现

 1         print "\nUse '%s <command> --help' for individual command help." % sys.argv[0].split(os.path.sep)[-1]
 2 
 3 def main():
 4     args = sys.argv[1:]
 5 
 6     # The only shared option is '--addons-path=' needed to discover additional
 7     # commands from modules
 8     if len(args) > 1 and args[0].startswith('--addons-path=') and not args[1].startswith("-"):
 9         # parse only the addons-path, do not setup the logger...
10         odoo.tools.config._parse_config([args[0]])
11         args = args[1:]
12 
13     # Default legacy command
14     command = "server"

我想就是这里了

TODO:main()做了什么?