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

Fix #5062 - Properly forward the --help flag to ruby/python scripts #5065

Merged
merged 2 commits into from
Jan 2, 2024

Conversation

jmarrec
Copy link
Collaborator

@jmarrec jmarrec commented Dec 20, 2023

Pull request overview

When script omitted, --help displays the C++ subcommand help

$os_build_rel/Products/openstudio execute_ruby_script --help
Executes a ruby file
Usage: /Users/julien/Software/Others/OS-build-release/Products/openstudio execute_ruby_script [OPTIONS] path [args...]

Positionals:
  path RUBY_SCRIPT                 Path to Ruby file
  args ARG ...                     Extra Arguments forwarded to the Ruby script

Options:
  -h,--help                        Print this help message and exit

Any additional arguments passed after the Ruby file are forwarded

When --help is passed after the ruby script, the Ruby's script is displayed (if any):

$os_build_rel/Products/openstudio execute_ruby_script execute_ruby_script_optparse_path.rb --help
Usage: execute_ruby_script_optparse_path.rb -x building.xml

The Ruby help description.

    -x, --xml <FILE>                 HPXML file

Pull Request Author

  • Model API Changes / Additions
  • Any new or modified fields have been implemented in the EnergyPlus ForwardTranslator (and ReverseTranslator as appropriate)
  • Model API methods are tested (in src/model/test)
  • EnergyPlus ForwardTranslator Tests (in src/energyplus/Test)
  • If a new object or method, added a test in NREL/OpenStudio-resources: Add Link
  • If needed, added VersionTranslation rules for the objects (src/osversion/VersionTranslator.cpp)
  • Verified that C# bindings built fine on Windows, partial classes used as needed, etc.
  • All new and existing tests passes
  • If methods have been deprecated, update rest of code to use the new methods

Labels:

  • If change to an IDD file, add the label IDDChange
  • If breaking existing API, add the label APIChange
  • If deemed ready, add label Pull Request - Ready for CI so that CI builds your PR

Review Checklist

This will not be exhaustively relevant to every PR.

  • Perform a Code Review on GitHub
  • Code Style, strip trailing whitespace, etc.
  • All related changes have been implemented: model changes, model tests, FT changes, FT tests, VersionTranslation, OS App
  • Labeling is ok
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified

```
	3730 - OpenStudioCLI.execute_ruby_script.forward_flags.forward_help (Failed)
	3731 - OpenStudioCLI.execute_python_script.forward_flags.forward_help (Failed)
```
When script omitted, --help displays the C++ subcommand help

```
$os_build_rel/Products/openstudio execute_ruby_script --help
Executes a ruby file
Usage: /Users/julien/Software/Others/OS-build-release/Products/openstudio execute_ruby_script [OPTIONS] path [args...]

Positionals:
  path RUBY_SCRIPT                 Path to Ruby file
  args ARG ...                     Extra Arguments forwarded to the Ruby script

Options:
  -h,--help                        Print this help message and exit

Any additional arguments passed after the Ruby file are forwarded
```

When --help is passed after the ruby script, the Ruby's script is displayed (if any):

```
$os_build_rel/Products/openstudio execute_ruby_script execute_ruby_script_optparse_path.rb --help
Usage: execute_ruby_script_optparse_path.rb -x building.xml

The Ruby help description.

    -x, --xml <FILE>                 HPXML file
```
@jmarrec jmarrec added component - CLI Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge. component - Ruby bindings component - Python bindings labels Dec 20, 2023
@jmarrec jmarrec self-assigned this Dec 20, 2023
@wenyikuang
Copy link
Collaborator

Looks like the mac-incremental didn't work properly. I cleaned up the disk and re-ran it.

@jmarrec
Copy link
Collaborator Author

jmarrec commented Dec 29, 2023

@wenyikuang I just killed that rerun, it has been stalled for 8 days.

@jmarrec
Copy link
Collaborator Author

jmarrec commented Dec 29, 2023

@shorowit When you get a chance (after the holiday season is totally fine - and happy holidays!), if you could test that this is properly solving your problem that'd be great, then we can merge. Thanks!

Copy link
Contributor

@shorowit shorowit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested this and it worked as expected. Thanks for the quick fix, @jmarrec!

@jmarrec jmarrec merged commit 5de13e3 into develop Jan 2, 2024
4 of 6 checks passed
@jmarrec jmarrec deleted the 5062-execute_ruby_fwd_args branch January 16, 2024 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component - CLI component - Python bindings component - Ruby bindings Pull Request - Ready for CI This pull request if finalized and is ready for continuous integration verification prior to merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OS 3.7 CLI regression for openstudio foo.rb --help
4 participants