class Importmap::Commands
def pin(*packages)
def pin(*packages) if imports = packager.import(*packages, env: options[:env], from: options[:from]) imports.each do |package, url| puts %(Pinning "#{package}" to #{url}) pin = packager.pin_for(package, url) if packager.packaged?(package) gsub_file("config/importmap.rb", /^pin "#{package}".*$/, pin, verbose: false) else append_to_file("config/importmap.rb", "#{pin}\n", verbose: false) end end else puts "Couldn't find any packages in #{packages.inspect} on #{options[:provider]}" end end