Class: Taggata::Cli::TagCommand

Inherits:
Clamp::Command
  • Object
show all
Defined in:
lib/taggata/cli/tag.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/taggata/cli/tag.rb', line 8

def execute
  tags = ::Taggata::Parser::Tag.new(@db).parse(tag_query)
  files = ::Taggata::Parser::Query.new(@db).parse(search_query)
  @db.transaction do
    files.each do |file|
      file.add_tags *tags[:add]
      file.remove_tags *tags[:del]
    end
  end
end