Thor ile bazı komisyon görevleri yazıyorum. Bu zorlu görevlerde, komut satırını daha sağlam hale getirmek için bazı yöntem seçeneklerini belirtiyorum, ancak içine girdiğim sorun, thor'un komutlarımı tanımamasıdır. İşte Thor neden komut satırı seçeneğimi tanımıyor?
örnek bir iştir: Ben Thor resmi web sayfasını takipmodule ReverificationTask
class Notifications < Thor
option :bounce_threshold, :aliases => '-bt', :desc => 'Sets bounce rate', :required => true, :type => :numeric
option :num_email, :aliases => '-e', :desc => 'Sets the amount of email', :required => true, :type => :numeric
desc 'resend_to_soft_bounced_emails [BOUNCE_THRESHOLD] [NUM_EMAIL]'
def resend_to_soft_bounced_emails(bounce_rate, amount_of_email)
Reverification::Process.set_amazon_stat_settings(bounce_rate, amount_of_email)
Reverification::Mailer.resend_soft_bounced_notifications
end
end
end
'Seçenekler' WhatisThor ve ben thor help reverification_task:notifications:resend_to_soft_bounced_emails
çalıştırdığınızda O doğru ben görmeyi beklediğiniz çıkışı komut satırı argümanı:
Usage:
thor reverification_task:notifications:resend_to_soft_bounced_emails [BOUNCE_THRESHOLD] [NUM_EMAIL] -bt, --bounce-threshold=N -e, --num-email=N
Options:
-bt, --bounce-threshold=N # Sets bounce rate
-e, --num-email=N # Sets the amount of email
Ben thor reverification_task:notifications:resend_to_soft_bounced_emails -bt 20 -e 2000
bu yürütmek yanıttır:
No value provided for required options '--bounce-threshold'
Burada sorun nedir? Herhangi bir yardım büyük takdir edilecektir. Teşekkürler.