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: Handle '# [include]'. Update default config #450

Merged
merged 2 commits into from
Jun 1, 2023
Merged

fix: Handle '# [include]'. Update default config #450

merged 2 commits into from
Jun 1, 2023

Conversation

slowsage
Copy link
Contributor

Default config will now work (with commented out include section).

Standards checklist:

  • The PR title is descriptive.
  • I have read CONTRIBUTING.md
  • The code compiles (cargo build)
  • The code passes rustfmt (cargo fmt)
  • The code passes clippy (cargo clippy)
  • The code passes tests (cargo test)
  • Optional: I have tested the code myself
    • I also tested that Topgrade skips the step where needed

If you developed a feature or a bug fix for someone else and you do not have the
means to test it, please tag this person here.

@SteveLauC
Copy link
Member

In config.rs, almost every other types take Option<> field, IMHO, it would be better to make struct Include take Option<Vec<String>>, but this needs some extra work to be done as Merge(crate used to handle the file merging logic) does not support merge Option<Vec<T>>

pub struct Include {
    paths: Option<Vec<String>>,
}

@slowsage Would u like to implement this in this PR, if not, leaving it as is is still good enough to me:)

@slowsage
Copy link
Contributor Author

Vagrant has:

pub struct Vagrant {
    #[merge(strategy = crate::utils::merge_strategies::vec_prepend_opt)]
    directories: Option<Vec<String>>,

    power_on: Option<bool>,
    always_suspend: Option<bool>,
}

I can take a crack if vec_prepend_opt is the way.

@s34m
Copy link
Member

s34m commented May 31, 2023

Is it ready to be merged?

@SteveLauC
Copy link
Member

Is it ready to be merged?

Nope I guess, @slowsage is willing to implement this, and it may take some time:)

@slowsage
Copy link
Contributor Author

Tested it with paths as optional. Please confirm that I did the unwrap appropriately. Thank you!

@SteveLauC
Copy link
Member

LGTM! Thanks

@s34m s34m merged commit 03436b7 into topgrade-rs:master Jun 1, 2023
@slowsage slowsage deleted the include-fix branch June 2, 2023 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants