instantOS / imosid

instant manager of sections in dotfiles
GNU General Public License v2.0
4 stars 1 forks source link

Sweep: introduce imosid force option that overwrites files without checking if it has modified or invalid sections #3

Open paperbenni opened 1 year ago

paperbenni commented 1 year ago
Checklist - [X] `src/app.rs` ✅ Commit [`489683d`](https://github.com/instantOS/imosid/commit/489683d7e2e4d23e565f086838ee2abcf568b300)
• Add a new command-line argument for the force option in the `Command::new("apply")` subcommand. The argument should be a flag (i.e., it does not take a value), and it should be optional. • Modify the code that handles the "apply" subcommand to pass the value of the force option to the `DotFile::applyfile` function.
- [X] `src/files.rs` ✅ Commit [`0aca5be`](https://github.com/instantOS/imosid/commit/0aca5be8c7e2d1b4a9fe583628bd0999d526feb3)
• Modify the signature of the `DotFile::applyfile` function to take an additional boolean parameter that indicates whether the force option is enabled. • In the `DotFile::applyfile` function, add a condition at the beginning of the function that checks if the force option is enabled. If it is, skip the checks for modifications and invalid sections. • In the `DotFile::write_to_file` function, add a condition that checks if the force option is enabled. If it is, skip the checks for modifications and invalid sections.
sweep-ai[bot] commented 1 year ago

Here's the PR! https://github.com/instantOS/imosid/pull/4.

⚡ Sweep Free Trial: I'm creating this ticket using GPT-4. You have 4 GPT-4 tickets left for the month and 2 for the day. For more GPT-4 tickets, visit [our payment portal.](https://buy.stripe.com/6oE5npbGVbhC97afZ4)

Actions (click)


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/instantOS/imosid/blob/acf8d947b808cbd8761f1d930cae9be42e704fda/src/files.rs#L528-L685 https://github.com/instantOS/imosid/blob/acf8d947b808cbd8761f1d930cae9be42e704fda/src/files.rs#L59-L137 https://github.com/instantOS/imosid/blob/acf8d947b808cbd8761f1d930cae9be42e704fda/src/files.rs#L156-L264 https://github.com/instantOS/imosid/blob/acf8d947b808cbd8761f1d930cae9be42e704fda/src/app.rs#L32-L124 https://github.com/instantOS/imosid/blob/acf8d947b808cbd8761f1d930cae9be42e704fda/src/files.rs#L276-L421

Step 2: ⌨️ Coding


Step 3: 🔁 Code Review

I have finished reviewing the code for completeness. I did not find errors for sweep/force-option.

.


🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord