end
options = OptionParser.new do |opts|
- opts.banner = 'Usage: answerback-mail.rb [-e|--email email] '
- opts.banner += "[-s|--ssh-pubkey pub_key_file] [-f|--raw-email email_file] [-g|--gen-sshkey]\n"
- opts.banner += " -e or -f is required\n"
- opts.banner = 'Usage: answerback-mail.rb [-e|--email email] [-n|--name name] '
- opts.banner += "[-s|--ssh-pubkey pub_key_file] [-g|--gen-sshkey] [--login y|Y|n|N] [--update]\n"
Just show the y/n, you can change the letter to lowercase.
ok but in this description, need to show all cased values I will optimize it as the following
Thanks, Luan Shengde
Thanks, Xueliang
- end
- opts.on('-l Y|y|N|n', '--login Y|y|N|n', 'enable/disable user login permission') do |value|
- if %w[y Y].include? value
if value.downcase == y
conf_info['enable_login'] = true
- elsif %w[n N].include? value
elsif value.downcase == n
conf_info['enable_login'] = false
- else
raise 'invalid parameter, please use y|Y|n|N'
- end end