digital-asset / daml

The Daml smart contract language
https://www.digitalasset.com/developers
Other
802 stars 204 forks source link

Duplicate entries in usage (--help) output of daml damlc subcommands #16490

Open matevarga-da opened 1 year ago

matevarga-da commented 1 year ago

Affected Daml version

2.5.0-snapshot.20220925.10653.0.0db37eca and above

Bug description

Majority but not all the listed options appear twice in the usage output of daml damlc subcommands.

To reproduce

  1. Run daml damlc test --help using a daml version 2.5.0-snapshot.20220925.10653.0.0db37eca or above
  2. See output like this:
    
    Usage: damlc test [--project-root ARG] [--project-check] [--files [FILE]] 
                  [--all] [--show-coverage] [--color] [--junit FILENAME] 
                  [--package-name PACKAGE-NAME] [--include INCLUDE-PATH] 
                  [--package-db LOC-OF-PACKAGE-DB] [--access-token-file PATH] 
                  [--shake-profiling PROFILING-REPORT] [[--jobs THREADS]] 
                  [--debug | [--log-level ARG]] [--ghc-option OPTION] 
                  [(-p|--test-pattern PATTERN)] [--init-package-db ARG] 
                  [--table-output ARG] [--transactions-output ARG]
    Test the current Daml project or the given files by running all test
    declarations. Must be in Daml project if --files is not set.

Available options: -h,--help Show this help text --project-root ARG Path to the root of a project containing daml.yaml. You should prefer the DAML_PROJECT environment variable over this option.See https://docs.daml.com/tools/assistant.html#running-commands-outside-of-the-project-directory for more details. --project-root ARG Path to the root of a project containing daml.yaml. You should prefer the DAML_PROJECT environment variable over this option.See https://docs.daml.com/tools/assistant.html#running-commands-outside-of-the-project-directory for more details. --project-check Check if running in Daml project. --files Only run test declarations in the specified files. FILE Input .daml file whose contents are read --all Run tests in current project as well as dependencies --show-coverage Show detailed test coverage --color Colored test results --junit FILENAME Filename of JUnit output file --junit FILENAME Filename of JUnit output file --package-name PACKAGE-NAME create package artifacts for the given package name --package-name PACKAGE-NAME create package artifacts for the given package name --include INCLUDE-PATH Path to an additional source directory to be included --package-db LOC-OF-PACKAGE-DB use package database in the given location --access-token-file PATH Path to the token-file for ledger authorization. --access-token-file PATH Path to the token-file for ledger authorization. --shake-profiling PROFILING-REPORT Directory for Shake profiling reports --shake-profiling PROFILING-REPORT Directory for Shake profiling reports --jobs THREADS The number of threads to run in parallel. When -j is not passed, 1 thread is used. If -j is passed, the number of threads defaults to the number of processors. Use --jobs=N to explicitely set the number of threads to N. Note that the output is not deterministic for > 1 job. --jobs THREADS The number of threads to run in parallel. When -j is not passed, 1 thread is used. If -j is passed, the number of threads defaults to the number of processors. Use --jobs=N to explicitely set the number of threads to N. Note that the output is not deterministic for > 1 job. --debug Set log level to DEBUG --log-level ARG Set log level. Possible values are DEBUG, INFO, WARNING, ERROR --log-level ARG Set log level. Possible values are DEBUG, INFO, WARNING, ERROR --ghc-option OPTION Options to pass to the underlying GHC -p,--test-pattern PATTERN Only scripts with names containing the given pattern will be executed. -p,--test-pattern PATTERN Only scripts with names containing the given pattern will be executed. --init-package-db ARG Initialize package database Can be set to "yes", "no" or "auto" to select the default (True) --init-package-db ARG Initialize package database Can be set to "yes", "no" or "auto" to select the default (True) --table-output ARG Filename to which table should be output --table-output ARG Filename to which table should be output --transactions-output ARG Filename to which the transaction list should be output --transactions-output ARG Filename to which the transaction list should be output


# Expected behavior

To have all options listed once.

Usage: damlc test [--project-root ARG] [--project-check] [--files [FILE]] [--all] [--show-coverage] [--color] [--junit FILENAME] [--package-name PACKAGE-NAME] [--include INCLUDE-PATH] [--package-db LOC-OF-PACKAGE-DB] [--access-token-file PATH] [--shake-profiling PROFILING-REPORT] [--jobs THREADS] [--debug | --log-level ARG] [--ghc-option OPTION] [-p|--test-pattern PATTERN] [--init-package-db ARG] Test the current Daml project or the given files by running all test declarations. Must be in Daml project if --files is not set.

Available options: -h,--help Show this help text --project-root ARG Path to the root of a project containing daml.yaml. You should prefer the DAML_PROJECT environment variable over this option.See https://docs.daml.com/tools/assistant.html#running-commands-outside-of-the-project-directory for more details. --project-check Check if running in Daml project. --files Only run test declarations in the specified files. FILE Input .daml file whose contents are read --all Run tests in current project as well as dependencies --show-coverage Show detailed test coverage --color Colored test results --junit FILENAME Filename of JUnit output file --package-name PACKAGE-NAME create package artifacts for the given package name --include INCLUDE-PATH Path to an additional source directory to be included --package-db LOC-OF-PACKAGE-DB use package database in the given location --access-token-file PATH Path to the token-file for ledger authorization. --shake-profiling PROFILING-REPORT Directory for Shake profiling reports --jobs THREADS The number of threads to run in parallel. When -j is not passed, 1 thread is used. If -j is passed, the number of threads defaults to the number of processors. Use --jobs=N to explicitely set the number of threads to N. Note that the output is not deterministic for > 1 job. --debug Set log level to DEBUG --log-level ARG Set log level. Possible values are DEBUG, INFO, WARNING, ERROR --ghc-option OPTION Options to pass to the underlying GHC -p,--test-pattern PATTERN Only scripts with names containing the given pattern will be executed. --init-package-db ARG Initialize package database Can be set to "yes", "no" or "auto" to select the default (True)



# Additional context

I suspect this commit may have been the culprit to produce the issue, but could not pinpoint how:
https://github.com/digital-asset/daml/commit/5a3cb468f8fa0bb3b702a55373876e69334a6f9e
dylant-da commented 1 year ago

The modification on https://github.com/digital-asset/daml/commit/5a3cb468f8fa0bb3b702a55373876e69334a6f9e#diff-efbb6576741b416a195424f054dc08c161fc88843220600164e108fff9eb9372R71-R75 are responsible - hidden hides the option from the short help output, but not from the full help output. Fixing in https://github.com/digital-asset/daml/pull/16491

wallacekelly-da commented 1 year ago

Related to (duplicate?) #16050