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 #{packager.vendor_path}/#{package}.js via download from #{url})
      packager.download(package, url)
      pin = packager.vendored_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[:from]}"
  end
end