Problem with short operations + underscores
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 259
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
Given:
```
parser = Trollop::Parser.new do
opt :silent, %q{Causes the script to not ask any questions, instead all questions turn into email + abort; used by cron}, :short => 's'
opt :region, %q{Causes the script only work on the listed region}, :short => 'r', :type => String
opt :noinst, %q{Causes the script to skip the checking of all instances}, :short => 'i'
end
```
Running it with -i gives us:
```
{:silent=>false,
:region=>nil,
:noinst=>true,
:help=>false,
:noinst_given=>true}
```
However, given:
```
parser = Trollop::Parser.new do
opt :silent, %q{Causes the script to not ask any questions, instead all questions turn into email + abort; used by cron}, :short => 's'
opt :region, %q{Causes the script only work on the listed region}, :short => 'r', :type => String
opt :no_instances, %q{Causes the script to skip the checking of all instances}, :short => 'i'
end
```
which is what I had originally, running it with -i gives:
```
{:silent=>false,
:region=>nil,
:no_instances=>false,
:help=>false,
:no_instances_given=>true}
```
which strikes me as wrong.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two Trollop::Parser.new examples using the opt declarations and the -i argument. Trace how short options map to underscored option names, then verify that the corrected behavior sets no_instances to true and preserves the corresponding _given value.
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
- 45/100