changeset 898722955ad6 in modules/currency:default
details: https://hg.tryton.org/modules/currency?cmd=changeset&node=898722955ad6
description:
        Add command line completion with argcomplete

        issue11592
        review419481003
diffstat:

 scripts/import_currencies.py |  8 ++++++++
 setup.py                     |  1 +
 2 files changed, 9 insertions(+), 0 deletions(-)

diffs (41 lines):

diff -r a63f34d4f523 -r 898722955ad6 scripts/import_currencies.py
--- a/scripts/import_currencies.py      Tue May 31 10:13:13 2022 +0200
+++ b/scripts/import_currencies.py      Fri Aug 26 18:12:02 2022 +0200
@@ -1,4 +1,5 @@
 #!/usr/bin/env python3
+# PYTHON_ARGCOMPLETE_OK
 # This file is part of Tryton.  The COPYRIGHT file at the top level of
 # this repository contains the full copyright notices and license terms.
 import gettext
@@ -10,6 +11,11 @@
 from forex_python.converter import CurrencyCodes
 
 try:
+    import argcomplete
+except ImportError:
+    argcomplete = None
+
+try:
     from progressbar import ETA, Bar, ProgressBar, SimpleProgress
 except ImportError:
     ProgressBar = None
@@ -106,6 +112,8 @@
     parser.add_argument('-d', '--database', dest='database', required=True)
     parser.add_argument('-c', '--config', dest='config_file',
         help='the trytond config file')
+    if argcomplete:
+        argcomplete.autocomplete(parser)
 
     args = parser.parse_args()
     main(args.database, args.config_file)
diff -r a63f34d4f523 -r 898722955ad6 setup.py
--- a/setup.py  Tue May 31 10:13:13 2022 +0200
+++ b/setup.py  Fri Aug 26 18:12:02 2022 +0200
@@ -147,6 +147,7 @@
             'pycountry', 'forex-python', get_require_version('proteus')],
         'ecb_rate': ['forex-python'],
         'test': tests_require,
+        'completion': ['argcomplete'],
         },
     dependency_links=dependency_links,
     zip_safe=False,

Reply via email to