Class: Foxtail::CLI::Commands::Ids
- Inherits:
-
Dry::CLI::Command
- Object
- Dry::CLI::Command
- Foxtail::CLI::Commands::Ids
- Defined in:
- lib/foxtail/cli/commands/ids.rb
Overview
Extract message and term IDs from FTL files
Instance Method Summary collapse
-
#call(files:, only_messages:, only_terms:, with_attributes:, json:) ⇒ void
Execute the ids command.
Instance Method Details
#call(files:, only_messages:, only_terms:, with_attributes:, json:) ⇒ void
This method returns an undefined value.
Execute the ids command
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/foxtail/cli/commands/ids.rb', line 27 def call(files:, only_messages:, only_terms:, with_attributes:, json:, **) raise Foxtail::CLI::NoFilesError if files.empty? ids = [] files.each do |file| ids.concat(extract_ids(file, only_messages:, only_terms:, with_attributes:)) end if json out.puts JSON.pretty_generate(ids) else ids.each {|id| out.puts id } end end |