namespace :rails_app do desc 'task with arguments' task :task, [:option1, :option2] => :environment do |_task, args| puts 'rails_app:task', args end end $> rails 'rails_app:task[1,2] => work: {:option1=>"1", :option1=>"2"}