Class: PolyglotFlutter::Command::Projects
Direct Known Subclasses
Setup
Constant Summary
Helper::General::ESCAPE_KEYWORDS
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
#clean_enum_name, #clean_variable_name, #config, #escape_keyword_if_needed, #escape_with_underscore_if_needed, #extract_translations, #find_app_language, #generate_locales, #generate_localization_keys, #generate_static_locales, #generate_strings, #indent, #project_configs, #token
#prompt, #success
Constructor Details
#initialize(options = Commander::Command::Options.new) ⇒ Projects
Returns a new instance of Projects.
16
17
18
|
# File 'lib/flutter_polyglot_cli/commands/projects.rb', line 16
def initialize(options = Commander::Command::Options.new)
@options = options
end
|
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
10
11
12
|
# File 'lib/flutter_polyglot_cli/commands/projects.rb', line 10
def options
@options
end
|
Class Method Details
.init(options = Commander::Command::Options.new) ⇒ Object
12
13
14
|
# File 'lib/flutter_polyglot_cli/commands/projects.rb', line 12
def self.init(options = Commander::Command::Options.new)
new(options).call
end
|
Instance Method Details
#call ⇒ Object
20
21
22
|
# File 'lib/flutter_polyglot_cli/commands/projects.rb', line 20
def call
list_projects
end
|
#filtered_projects ⇒ Object
24
25
26
27
28
29
|
# File 'lib/flutter_polyglot_cli/commands/projects.rb', line 24
def filtered_projects
projects
.select { |key, _id| key[/^(.*?(#{option_query})[^$]*)$/i] }
.sort_by { |p| p[0].downcase }
.to_h
end
|
#option_query ⇒ Object
38
39
40
|
# File 'lib/flutter_polyglot_cli/commands/projects.rb', line 38
def option_query
@option_query ||= @options.__hash__.fetch(:query, '')
end
|
#projects ⇒ Object
31
32
33
34
35
36
|
# File 'lib/flutter_polyglot_cli/commands/projects.rb', line 31
def projects
prompt.say('Getting projects...')
PolyglotFlutter::Resource::Project.token(token).depaginate.each_with_object({}) do |r, hash|
hash[r.name] = r.id
end
end
|