Skip to content

Commit

Permalink
Fix method overwriting error of dbg_generate in precompilation and …
Browse files Browse the repository at this point in the history
…enable more flexible calling signatures (#514)
  • Loading branch information
hz-xiaxz authored Nov 1, 2024
1 parent 6af0725 commit 7716574
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning].

## [Unreleased]

### Fixed

- Fix method overwriting error of `dbg_generate` in precompilation and enable more flexible calling signatures (#514)

## [0.14.0] - 2024-10-29

BREAKING NOTICE:
Expand Down
18 changes: 14 additions & 4 deletions src/debug/helper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function dbg_data(data_choice, _data = Dict())
Data.minimum_defaults
elseif data_choice in [:minimum, :min]
Data.strategy_minimum
elseif data_choice in [:recommended, (:recommended_only):rec, :rec_only]
elseif data_choice in [:recommended, :recommended_only, :rec, :rec_only]
Data.strategy_recommended_only
elseif data_choice in [:recommended_ask, :rec_ask]
Data.strategy_recommended_ask
Expand All @@ -52,12 +52,20 @@ end
dbg_generate([dst_path, data]; data_choice=:minimum)
Convenience function to help debug `generate`.
It runs `generate` with the `dst_path` destination (random by default) and the given `data`
(nothing by default).
It also uses a `data_choice` to determine fake starting data. This is passed to
[`dbg_data`](@ref).
This function can be called in multiple ways:
- `dbg_generate()`: Use all defaults
- `dbg_generate(my_data::Dict)`: Use `my_data` and all defaults
- `dbg_generate(dst_path::String)`: Use `dst_path` and all defaults
- `dbg_generate(data_choice::Symbol)`: Use all defaults and `data_choice` to generate `my_data`
It uses the `pkgdir` location of Bestie and adds the flags
- `defaults = true`: Sent to copier to use the default answers.
Expand All @@ -66,8 +74,8 @@ It uses the `pkgdir` location of Bestie and adds the flags
changes.
"""
function dbg_generate(
dst_path = rand_pkg_name(),
_data = Dict();
dst_path::String = rand_pkg_name(),
_data::Dict = Dict();
data_choice::Symbol = :minimum,
kwargs...,
)
Expand All @@ -83,7 +91,9 @@ function dbg_generate(
)
end

dbg_generate(_data = Dict(); kwargs...) = dbg_generate(rand_pkg_name(), _data; kwargs...)
dbg_generate(_data::Dict, kwargs...) = dbg_generate(rand_pkg_name(), _data; kwargs...)
dbg_generate(data_choice::Symbol, kwargs...) =
dbg_generate(rand_pkg_name(), Dict(); data_choice, kwargs...)

"""
dbg_apply([dst_path, data]; data_choice=:minimum)
Expand Down

0 comments on commit 7716574

Please sign in to comment.