I came across this today. You can write Rake tasks that accept arguments, called like this:
rake tweets:send[cpytel]
You define the rask task like this:
namespace :tweets do
desc 'Send some tweets to a user'
task :send, [:username] => [:environment] do |t, args|
Tweet.send(args[:username])
end
end
Unfortunately, zsh can’t parse the call to the rake task correctly, so you’ll see the error:
zsh: no matches found: tweets:send[cpytel]
So you’ll need to run it like this:
rake tweets:send\[cpytel\]
Or this:
rake 'tweets:send[cpytel]'