Skip to content

Commit

Permalink
Guess on apply for pkg already using copier
Browse files Browse the repository at this point in the history
Even if the dst_path contains a .copier-answers.yml file,
guess the starting answers. This only happens if the user
explicitly uses warn_existing_pkg=false, so it is in line
with the expectations.

Closes #383
  • Loading branch information
abelsiqueira committed Jul 25, 2024
1 parent 57ba597 commit e9be81c
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/BestieTemplate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,14 @@ function apply(src_path, dst_path, data::Dict = Dict(); warn_existing_pkg = true
end

# If there are answers in the destination path, skip guessing the answers
if !isfile(joinpath(dst_path, ".copier-answers"))
existing_data = _read_data_from_existing_path(dst_path)
for (key, value) in existing_data
@info "Inferred $key=$value from destination path"
if haskey(data, key)
@info " Being overriden by supplied $key=$(data[key]) value"
end
existing_data = _read_data_from_existing_path(dst_path)
for (key, value) in existing_data
@info "Inferred $key=$value from destination path"
if haskey(data, key)
@info " Being overriden by supplied $key=$(data[key]) value"
end
data = merge(existing_data, data)
end
data = merge(existing_data, data)

_copy(src_path, dst_path, data; kwargs...)

Expand Down

0 comments on commit e9be81c

Please sign in to comment.