Skip to content

New Feature: klirr data edit #10

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

Merged
merged 7 commits into from
Jul 1, 2025
Merged

New Feature: klirr data edit #10

merged 7 commits into from
Jul 1, 2025

Conversation

Sajjon
Copy link
Owner

@Sajjon Sajjon commented Jul 1, 2025

Add new feature, a command to edit the data. the data init and data edit commands share the same underlying flow, now upgraded to use data: Data (Data::sample() for init).

Use can select which part of the data to edit, all or just vendor or just client etc.

Also add a .release.toml to use with cargo-release (not tried yet)`.

@Sajjon Sajjon requested a review from Copilot July 1, 2025 17:45
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a new data edit command alongside refactored initialization logic, enabling users to selectively edit parts of the invoice data with existing values prefilled.

  • Refactor init/edit flows into a shared input_data_at function accepting defaults.
  • Introduce DataSelector to allow editing all or specific sections (vendor, client, etc.).
  • Update CLI TUI inputs to use existing data as defaults and wire up data edit in dispatch and README.

Reviewed Changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/core/src/models/year_and_month.rs Removed obsolete month_year method
crates/core/src/models/month.rs Dropped name method in localization refactor
crates/core/src/models/font_weight.rs Added FontWeight enum
crates/core/src/models/data/data.rs Derived WithSetters and added setter for client field
crates/core/src/logic/read_write_data/read_data_from_disk.rs Renamed data_dir to data_dir_create_if and added non-creating alias
crates/core/src/logic/command.rs Extracted input_data_at; added init_data_at, edit_data_at, DataSelector
crates/cli/src/input/tui.rs Updated prompts to use defaults; added WithDefaultMaybe trait
crates/cli/src/input/get_input.rs Added EditDataInput and mapped to DataSelector
crates/cli/src/dispatch_command.rs Connected data edit via curry helper
crates/cli/src/README.md Documented new data edit usage and updated description
.release.toml Added workspace release configuration
.envrc Sourced secret file before exporting RUST_LOG
Comments suppressed due to low confidence (5)

crates/core/src/logic/read_write_data/read_data_from_disk.rs:27

  • Update the panic message to reflect the actual function and include the failing path, e.g.: expect(format!("Unable to create data directory at {}", dir.display())).
            .expect("Should be able to create directory at data_dir()/klirr/data");

crates/core/src/logic/read_write_data/read_data_from_disk.rs:20

  • Add unit tests for data_dir_create_if(true) and data_dir_create_if(false) to verify directory creation and non-creation behavior.
pub fn data_dir_create_if(create_if_not_exists: bool) -> PathBuf {

crates/core/src/logic/command.rs:4

  • Add a doc comment explaining the purpose, parameters, and expected behavior of input_data_at for better maintainability.
fn input_data_at(

crates/core/src/logic/command.rs:38

  • Provide a doc comment for edit_data_at, outlining its role, arguments, and side effects to aid future readers.
pub fn edit_data_at(

crates/cli/src/input/tui.rs:55

  • [nitpick] The trait name WithDefaultMaybe is somewhat vague; consider renaming to WithOptionalDefault or similar to clearly convey its purpose.
trait WithDefaultMaybe<'o, T> {

Copy link

codecov bot commented Jul 1, 2025

Codecov Report

Attention: Patch coverage is 97.14286% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.25%. Comparing base (af1dea7) to head (87cc57d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...e/src/logic/read_write_data/read_data_from_disk.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #10      +/-   ##
==========================================
+ Coverage   96.45%   97.25%   +0.80%     
==========================================
  Files          59       59              
  Lines        1296     1312      +16     
==========================================
+ Hits         1250     1276      +26     
+ Misses         46       36      -10     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Sajjon Sajjon changed the title New feature edit data New Feature: klirr data edit Jul 1, 2025
@Sajjon Sajjon merged commit 3c2532f into main Jul 1, 2025
7 checks passed
@Sajjon Sajjon deleted the new_feature_edit_data branch July 1, 2025 20:21
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.

1 participant