Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue #513 #514

Merged
merged 3 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
hz-xiaxz marked this conversation as resolved.
Show resolved Hide resolved
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...)
hz-xiaxz marked this conversation as resolved.
Show resolved Hide resolved
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