Can't pass parameters to rake task
Open
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.5k
- Forks
- 650
- Avg merge
- 6m
- Merged PRs (30d)
- 3
Description
I have this task:
desc 'Tests input parameters'
task :params do |args|
options = {}
OptionParser.new(args) do |opts|
opts.banner = "Usage: rake params [options]"
opts.on("-F", "--file {file}", "A file", String) do |file|
options[:file] = file
end
end.parse!
puts options.inspect.green
end
rake params -- -Fmy_file.txt
In rake 10.3.x I receive:
{:file => "my_file.txt"}
In rake 10.4.x I receive:
{}
Why?
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
No source file or test is named. Start by reproducing rake params -- -Fmy_file.txt against Rake 10.3.x and 10.4.x, then trace how task arguments are passed to the OptionParser entry point. Done means explaining the version difference and covering the regression with a test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100