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

chore: Allow partial configuration file #116

Merged
merged 6 commits into from
Aug 26, 2023
Merged

chore: Allow partial configuration file #116

merged 6 commits into from
Aug 26, 2023

Conversation

PThorpe92
Copy link
Contributor

@PThorpe92 PThorpe92 commented Aug 24, 2023

Description

This PR allows for the mandatory args that need to be generated from the config file, if the config file is found, be filled in with default arguments should they not be included in the found config file.

Please let me know if I missed anything, and thank you for the awesome program 👍

Motivation and Context

closes #105

How Has This Been Tested?

I tested this locally on my machine by placing a config file in ~/.config/gpg-tui and
filling adding and removing parts to make sure the program will still start.

I also wrote a test test_args_partial_config and included a partial conifg file gpg-tui-part in the config directory of the repo, and ran assertions for the missing arguments.

Output (if appropriate):

The program will still start, despite fields missing in the configuration file.

PREV:
image
AFTER:
Well it works 👍 a screenshot of the program running is probably overkill.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have formatted the code with rustfmt.
  • I checked the lints with clippy.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@PThorpe92 PThorpe92 requested a review from orhun as a code owner August 24, 2023 15:28
Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking this up! 💖

I just had some comments for improvement.

config/gpg-tui-part.toml Outdated Show resolved Hide resolved
src/config.rs Show resolved Hide resolved
src/config.rs Outdated Show resolved Hide resolved
src/config.rs Outdated Show resolved Hide resolved
@PThorpe92
Copy link
Contributor Author

PThorpe92 commented Aug 25, 2023

Take a look and let me know what you think, by making those both Option, it did add some complexity when setting the default values but I added the two tests, one for each section, with the opposing one missing and then tested in both cases for each one.

Idk what's going on with CI but I made changes it requested. Fsr clippy didn't give the same warnings when ran locally with the same command.

@orhun orhun self-requested a review August 25, 2023 11:27
@codecov-commenter
Copy link

codecov-commenter commented Aug 26, 2023

Codecov Report

Patch coverage: 91.90% and project coverage change: -0.10% ⚠️

Comparison is base (354aecb) 62.19% compared to head (e89b2be) 62.08%.
Report is 1 commits behind head on master.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #116      +/-   ##
==========================================
- Coverage   62.19%   62.08%   -0.10%     
==========================================
  Files          27       27              
  Lines        2240     2260      +20     
==========================================
+ Hits         1393     1403      +10     
- Misses        847      857      +10     
Flag Coverage Δ
unit-tests 62.08% <91.90%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/app/prompt.rs 81.54% <ø> (ø)
src/main.rs 0.00% <0.00%> (ø)
src/config.rs 83.73% <94.29%> (-8.58%) ⬇️
src/app/style.rs 85.33% <100.00%> (-0.91%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, overall it looks good. I just pushed e89b2be for cleanup.

Also I have 2 questions, then we can merge 🐻

Cargo.lock Outdated Show resolved Hide resolved
src/config.rs Outdated Show resolved Hide resolved
@orhun orhun self-requested a review August 26, 2023 12:46
@orhun orhun changed the title Allow partial configuration file #105 chore: Allow partial configuration file Aug 26, 2023
Copy link
Owner

@orhun orhun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

@orhun orhun merged commit a7b4a3e into orhun:master Aug 26, 2023
3 checks passed
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.

Allow partial configuration file where some configuration keys may be missing
3 participants