Files
manyfold/app/lib/cli/libraries_command.rb
2026-02-09 15:45:58 +00:00

18 lines
593 B
Ruby

require "thor"
module Cli
class LibrariesCommand < Thor
namespace :libraries
DESCRIPTION = "manage libraries"
desc "scan", "scan library for filesystem changes"
option :name, required: false, type: :string, description: "library name to be scanned"
def scan
scope = Library.all # rubocop:disable Pundit/UsePolicyScope
scope = scope.where(name: options[:name]) if options[:name].presence
puts "\nQueueing #{scope.count} #{"library".pluralize(scope.count)} for filesystem scan"
scope.find_each(&:detect_filesystem_changes_later)
end
end
end