libosmocore[master]: utils/ improve application flexibility

Vadim Yanitskiy gerrit-no-reply at
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: [-h] [-p PREFIX] [-n TARGET_NAME] [-P TARGET_PATH]
                   {gen_codes,gen_vectors,gen_header} {gsm}

positional arguments:
                        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
To unsubscribe, visit

Gerrit-MessageType: comment
Gerrit-Change-Id: I0b476b00234c17f78b41d695cf3bfd13edb64c28
Gerrit-PatchSet: 4
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Vadim Yanitskiy <axilirator at>
Gerrit-Reviewer: Harald Welte <laforge at>
Gerrit-Reviewer: Holger Freyther <holger at>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at>
Gerrit-Reviewer: tnt <tnt at>
Gerrit-HasComments: No

More information about the gerrit-log mailing list