libosmocore[master]: utils/conv_gen.py: improve application flexibility

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Wed Feb 1 12:56:30 UTC 2017


Patch Set 4:

> -1 because of tnt's comment. Using a "native" python way to define
 > commands.. will reduce code size, provide good help too.

Well, I just made an attempt to use argparse instead of getopt.
Of course, this way reduced the code size and provided some help automatically.
But, personally for me, the new help message looks a bit confusing... And the
message, that manually wrote by myself, looks more informative. Let's compare:

usage: conv_gen.py [-h] [-p PREFIX] [-n TARGET_NAME] [-P TARGET_PATH]
                   {gen_codes,gen_vectors,gen_header} {gsm}

positional arguments:
  {gen_codes,gen_vectors,gen_header}
                        what to generate
  {gsm}                 convolutional code family

optional arguments:
  -h, --help            show this help message and exit
  -p PREFIX, --prefix PREFIX
                        internal naming prefix
  -n TARGET_NAME, --target-name TARGET_NAME
                        target name for generated file
  -P TARGET_PATH, --target-path TARGET_PATH
                        target path for generated file

witch the previous one. I looked for opportunity to customize the help output,
but such approach requires to create a new class and redefine some internal methods.

So, if usage of argparse is mandatory, I will rewrite the code, and will not care about help.

-- 
To view, visit https://gerrit.osmocom.org/1584
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I0b476b00234c17f78b41d695cf3bfd13edb64c28
Gerrit-PatchSet: 4
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
Gerrit-HasComments: No



More information about the gerrit-log mailing list