lib/mix/tasks/phx/copy.ex

defmodule Mix.Tasks.Phx.Copy do
  @moduledoc """
  Copies files according to the given profile's configuration.

  Usage:

      $ mix phx.copy PROFILE

  Prior to running, the given PROFILE must be properly configured in `config/config.exs`.
  See the documentation of `Phoenix.Copy` for more information.
  """
  use Mix.Task

  @shortdoc "Copies files according to the given profile's configuration"

  @impl Mix.Task
  def run([profile]) do
    Application.ensure_all_started(:phoenix_copy)
    Phoenix.Copy.run(String.to_atom(profile))
  end

  def run(_args) do
    Mix.raise("`mix phx.copy` expects the profile as its only argument")
  end
end