@@ -37,8 +37,8 @@ def download
37
37
38
38
desc "export [--locales=de fr-FR en-ZA] [--components=Numbers Plurals] [--target=#{ Cldr ::Export ::DEFAULT_TARGET } ] [--merge/--no-merge]" ,
39
39
"Export CLDR data by locales and components to target dir"
40
- option :locales , aliases : [ :l ] , type : :array , banner : "de fr-FR en-ZA" , enum : Cldr ::Export ::Data ::RAW_DATA . locales
41
- option :components , aliases : [ :c ] , type : :array , banner : "Numbers Plurals" , enum : Cldr ::Export ::Data . components
40
+ option :locales , aliases : [ :l ] , type : :array , banner : "de fr-FR en-ZA" , enum : Cldr ::Export ::Data ::RAW_DATA . locales . map ( & :to_s )
41
+ option :components , aliases : [ :c ] , type : :array , banner : "Numbers Plurals" , enum : Cldr ::Export ::Data . components . map ( & :to_s )
42
42
option :target , aliases : [ :t ] , type : :string , default : Cldr ::Export ::DEFAULT_TARGET , banner : Cldr ::Export ::DEFAULT_TARGET
43
43
option :draft_status ,
44
44
aliases : [ :d ] ,
@@ -53,17 +53,11 @@ def export
53
53
54
54
formatted_options = options . dup . symbolize_keys
55
55
56
- # We do this validation, since thor doesn't
57
- # https://github.com/rails/thor/issues/783
58
56
if formatted_options . key? ( :locales )
59
- formatted_options [ :locales ] = formatted_options [ :locales ] . map ( &:to_sym ) if formatted_options . key? ( :locales )
60
- unknown_locales = formatted_options [ :locales ] - Cldr ::Export ::Data ::RAW_DATA . locales
61
- raise ArgumentError , "Unknown locales: #{ unknown_locales . map { |l | "`#{ l } `" } . join ( ", " ) } " unless unknown_locales . empty?
57
+ formatted_options [ :locales ] = formatted_options [ :locales ] . map ( &:to_sym )
62
58
end
63
59
if formatted_options . key? ( :components )
64
- formatted_options [ :components ] = formatted_options [ :components ] . map ( &:to_sym ) if formatted_options . key? ( :components )
65
- unknown_components = formatted_options [ :components ] - Cldr ::Export ::Data . components
66
- raise ArgumentError , "Unknown components: #{ unknown_components . join ( ", " ) } " unless unknown_components . empty?
60
+ formatted_options [ :components ] = formatted_options [ :components ] . map ( &:to_sym )
67
61
end
68
62
69
63
if formatted_options . key? ( :draft_status )
0 commit comments