ManageIQ / ManageIQ/optimist

Using banner disables usage & synopsis

Open
#89 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug help wanted
Dominant language
Ruby
Stars
259
Forks
35
PR merge metrics
No merged PRs in 30d

Description

Example option block :

```
opts = Trollop::options do
version 0.1

usage "foo|bar"
synopsis "Reticulate splines"

banner "Recognized options: "
opt :dry_run, "Don't do anything", short: "-n"
end
```

Output when passed `--help` is :
```
Recognized options:
-n, --dry-run Don't do anything
-v, --version Print version and exit
-h, --help Show this message
```

If I comment *just* the banner line, I get this :
```
Usage: test foo|bar
Reticulate splines

0.1
Options:
-n, --dry-run Don't do anything
-v, --version Print version and exit
-h, --help Show this message
```

Additionally, I get warnings (the shebang line is `#!/usr/bin/env ruby -W`) depending on whether the `usage` or `synopsis` lines are comment out :
```
$gem-path/trollop-2.1.2/lib/trollop.rb:480: warning: instance variable @usage not initialized
$gem-path/trollop-2.1.2/lib/trollop.rb:481: warning: instance variable @synopsis not initialized
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the Ruby option block shown in the report, comparing output with and without the banner line and with usage or synopsis commented out. Trace how banner, usage, and synopsis are handled when --help is rendered, then ensure the usage and synopsis remain available and the uninitialized-variable warnings are resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.