Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some problems with optional arguments #459

Open
paulocoutinhox opened this issue Oct 2, 2019 · 3 comments
Open

Some problems with optional arguments #459

paulocoutinhox opened this issue Oct 2, 2019 · 3 comments

Comments

@paulocoutinhox
Copy link

paulocoutinhox commented Oct 2, 2019

Hi,

I have the following docot:

mytool

Usage:
  mytool generate <file> [options]
  mytool -h | --help
  mytool -d | --debug

Options:
  -h --help            Show this screen.
  -d --debug           Enable debug messages.
  --version            Show version.

Generator Java:
  --java-out VALUE                              The output for the Java files (Generator disabled if unspecified).
  --java-package VALUE                          The package name to use for generated Java classes.
  --java-class-access-modifier VALUE            The access modifier to use for generated Java classes (default: public).
  --java-cpp-exception VALUE                    The type for translated C++ exceptions in Java (default: java.lang.RuntimeException that is not checked)
  --java-annotation VALUE                       Java annotation (@Foo) to place on all generated Java classes
  --java-generate-interfaces VALUE              Whether Java interfaces should be used instead of abstract classes where possible (default: false).
  --java-nullable-annotation VALUE              Java annotation (@Nullable) to place on all fields and return values that are optional
  --java-nonnull-annotation VALUE               Java annotation (@Nonnull) to place on all fields and return values that are not optional
  --java-implement-android-os-parcelable VALUE  All generated java classes will implement the interface android.os.Parcelable
  --java-use-final-for-record VALUE             Whether generated Java classes for records should be marked 'final' (default: true).

Examples:
  mytool generate my-project.ginny

Help:
  For help using this tool, please open an issue on the Github repository:
  https://github.com/mytool/mytool

But when i call the following command it not work:

mytool generate my-file.ext --java-out=teste --java-annotation="anot" -d

And show usage:

Usage:
  mytool generate <file> [options]
  mytool -h | --help
  mytool -d | --debug

But if i remove "-d" option, it works.

What is wrong?

Thanks.

@eaaltonen
Copy link

Looks like a case of

New in version 0.6.0:
Breaking changes:

M* eaning of [options] shortcut slightly changed. Previously it meant "any known option". Now it means "any option not in usage-pattern". This avoids the situation when an option is allowed to be repeated unintentionally.

@noraj
Copy link

noraj commented Jun 9, 2021

Yeah it forces me to do stuff like that and declare the debug option for each command:

  Usage:
    tls-map search <critera> <term> [-o <output> --force -e -a] [--no-color --debug]
    tls-map bulk <critera> <file> [-z <output> --force] [--no-color --debug]
    tls-map export <filename> <format> [--force] [--debug]
    tls-map extract <filename> <format> [--no-color --debug]
    tls-map update [--debug]
    tls-map -h | --help
    tls-map --version

  Search options: (offline) search and translate cipher names between SSL/TLS libraries
    <critera>               The type of term. Accepted values: codepoint, iana, openssl, gnutls, nss.
    <term>                  The cipher algorithm name.
    -o, --output <output>   Displayed fields. Accepted values: all, codepoint, iana, openssl, gnutls, nss. [default: all]
    -e, --extended          (Online) Display additional information about the cipher (requires output = all or iana)
    -a, --acronym           (Online) Display full acronym name (requires -e / --extended option)

  Bulk options: (offline) search and translate cipher names between SSL/TLS libraries in bulk
    <critera>               The type of term. Accepted values: codepoint, iana, openssl, gnutls, nss.
    <file>                  File containing the cipher algorithm names, one per line.
    -z, --output2 <output>  Displayed fields. Accepted values: codepoint, iana, openssl, gnutls, nss. [default: iana]

  Export options: (offline) export the list of all ciphers (mapping) in various formats
    <filename>              The output file name to write to.
    <format>                Supported formats: markdown (a markdown table), json_pretty (expanded JSON), json_compact (minified JSON), marshal (Ruby marshalized hash).

  Extract options: (offline) extract ciphers from external tools output file
    <filename>              The external tool output file
    <format>                Supported formats: sslyze, sslscan2, testssl, ssllabs-scan (check the documentation for the expected file format)

  Update options: (online) DANGEROUS, will break database integrity, force option will be required

  Other options:
    --force     Force parsing even if integrity check failed (DANGEROUS, may result in command execution vulnerability)
    --no-color  Disable colorized output
    --debug     Display arguments
    -h, --help  Show this screen
    --version   Show version

[options] will apply all options. What we need is a way to define a custom option set eg [global_options] so we could put them in this set.

@eaaltonen
Copy link

#110 #294 #313

@noraj noraj mentioned this issue Jun 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants