[FIX] core: missing doc for some subcommands

Run `odoo-bin help`, you'll notice that some descriptions are missing,
this commit fixes that.

Run `odoo-bin shell --help`, you'll notice that the `usage:` line says
`odoo-bin [options]` instead of `odoo-bin shell [options]`. Other
commands that depend on the server cli are broken too. Fix those too.

closes odoo/odoo#121085

X-original-commit: 9c6bac741ff437564e7dbe4d0aa8dbd307b71f8d
Signed-off-by: Vincent Schippefilt (vsc) <vsc@odoo.com>
Signed-off-by: Julien Castiaux (juc) <juc@odoo.com>
This commit is contained in:
Julien Castiaux
2023-06-06 11:44:58 +02:00
parent eda66f0560
commit 27865152bb
12 changed files with 83 additions and 71 deletions
+7 -5
View File
@@ -1,10 +1,11 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import argparse
import io
import urllib.parse
import sys
import zipfile
from functools import partial
from pathlib import Path
from sys import argv, stdout, stderr
import requests
@@ -13,9 +14,10 @@ from .server import report_configuration
from ..service.db import dump_db, exp_drop, exp_db_exist, exp_duplicate_database, exp_rename, restore_db
from ..tools import config
eprint = partial(print, file=stderr, flush=True)
eprint = partial(print, file=sys.stderr, flush=True)
class Db(Command):
""" Create, drop, dump, load databases """
name = 'db'
def run(self, cmdargs):
@@ -25,8 +27,8 @@ class Db(Command):
all filestore-aware.
"""
parser = argparse.ArgumentParser(
prog="%s %s" % (Path(argv[0]).name, self.name),
description=self.__doc__
prog=f'{Path(sys.argv[0]).name} {self.name}',
description=self.__doc__.strip()
)
parser.add_argument('-c', '--config')
parser.add_argument('-D', '--data-dir')
@@ -146,7 +148,7 @@ class Db(Command):
def dump(self, args):
if args.dump_path == '-':
dump_db(args.database, stdout.buffer)
dump_db(args.database, sys.stdout.buffer)
else:
with open(args.dump_path, 'wb') as f:
dump_db(args.database, f)