Commit Graph

61 Commits

Author SHA1 Message Date
Jeremiah Russell
f7db97dd07 ♻️ refactor(cli): consolidate message handling and remove delete command
- 【Refactor】: Move `set_parameters` function from `Message` trait implementation for `DeleteCli` to `MessageCli` to avoid duplication.
- 【Feature】: Add `Delete` action to `MessageAction` enum to allow direct deletion of messages.
- 【Cleanup】: Remove `delete_cli.rs` and `message_trait.rs` as their functionalities are now integrated into `message_cli.rs`.
2025-10-14 17:10:21 +01:00
Jeremiah Russell
f3a1edaf1f ♻️ refactor(cli): refactor message handling and remove trash command
- 【Refactor】: Moved trash functionality into the message subcommand for better organization.
- 【Refactor】: Removed the separate `trash_cli` module.
- 【Feature】: Added a `Trash` action to the `MessageAction` enum.
- 【Refactor】: Modified `MessageCli::run` to handle the new `Trash` action.
2025-10-14 17:10:21 +01:00
Jeremiah Russell
1052eeb22e feat(cli): enhance cli subcommand ordering and grouping
- improve subcommand organization for better user experience
- implement display_order attribute for logical ordering of subcommands
- introduce next_help_heading for grouping subcommands under meaningful titles
2025-10-14 17:10:21 +01:00
Jeremiah Russell
02e58275e7 feat(cli): add message list subcommand
- add subcommand to list messages from gmail
- implement message listing functionality
- add ability to specify query and number of pages
2025-10-14 17:10:21 +01:00
Jeremiah Russell
1eefad2cff feat(cli): add configuration options for message listing
- Add max_results, pages, labels, and query options to message CLI
- Allow users to customize message retrieval with flags
2025-10-14 17:10:21 +01:00
Jeremiah Russell
b6a53461ce 🐛 fix(cli): correct label adding to use non-async function
- fix label adding to use non-async function
2025-10-14 07:41:39 +01:00
Jeremiah Russell
7b9be5f243 feat(cli): create message trait to share list parameters
- create message trait to share list parameters
- implement message trait for message and delete cli
2025-10-14 07:41:39 +01:00
Jeremiah Russell
e488cd25cf ♻️ refactor(cli): streamline message retrieval and parameter setting
- extract parameter setting logic into a separate function `set_parameters`
- consolidate label adding, query setting, and max results setting into `set_parameters`
- rename `run` to `get_messages` for clarity
- add methods for retrieving labels, query, and max_results
2025-10-14 07:41:39 +01:00
Jeremiah Russell
fe4a85f5e3 ♻️ refactor(cli): extract parameter setting logic
- move parameter setting into a separate function
- create getter functions for struct members
2025-10-14 07:41:39 +01:00
Jeremiah Russell
7e1d07b3ab feat(cli): add message trait for cli subcommands
- introduce a trait to handle message-related operations
- implement the trait for config, delete, label, message, run, and trash subcommands
2025-10-14 07:41:39 +01:00
Jeremiah Russell
ec5b7493c5 feat(cli): implement batch actions for trashing and deleting
- refactor `execute_action` to use `batch_trash` and `batch_delete`
- remove individual message trashing/deletion in favor of batch processing
- streamline action execution based on `self.execute` flag
2025-10-14 07:41:39 +01:00
Jeremiah Russell
011da42664 ♻️ refactor(cli): remove unused Delete import
- remove unused `Delete` import from `cull_gmail`
2025-10-14 07:41:39 +01:00
Jeremiah Russell
e02f0ee3d1 ♻️ refactor(cli): remove unused Delete, Trash trait
- Remove Delete and Trash traits from cull_gmail
- Use RuleProcessor instead of Delete and Trash traits
2025-10-14 07:41:39 +01:00
Jeremiah Russell
35235afc26 🐛 fix(cli): fix rule execution and client handling
- modify the `run` function to accept a mutable `GmailClient` reference
- set the rule and execute flag on the client before executing the action
- remove the `RuleProcessor` and directly use the `GmailClient` for actions
- this simplifies the code and ensures the client is properly configured for each rule
2025-10-14 07:41:39 +01:00
Jeremiah Russell
7c397c84d9 ♻️ refactor(cli): rename Processor to RuleProcessor
- rename `Processor` struct to `RuleProcessor` for better clarity
- update all references to reflect the change
2025-10-14 07:41:39 +01:00
Jeremiah Russell
5331551eea ♻️ refactor(cli): use mutable client for subcommands
- change `client` to mutable to allow modification in subcommands
- update subcommands to use the mutable `client`
2025-10-14 07:41:39 +01:00
Jeremiah Russell
c42f19d19a 🐛 fix(trash): fix trash command with new gmail client
- adapt trash command to use new gmail client methods
- remove unused `Trash` struct
2025-10-14 07:41:39 +01:00
Jeremiah Russell
bc2b4dab0f ♻️ refactor(message_cli): simplify message processing
- remove MessageList struct and move its functionality to GmailClient
- this reduces complexity and streamlines the message processing flow
2025-10-14 07:41:39 +01:00
Jeremiah Russell
0269668c8b ♻️ refactor(delete): streamline delete command execution
- modify delete command to directly use `GmailClient` methods
- remove intermediate `Delete` struct
- simplify command execution flow
2025-10-14 07:41:39 +01:00
Jeremiah Russell
4d452ab5b0 ♻️ refactor(cli): use GmailClient instead of credential file
- use GmailClient to reduce redundant credential file passing
2025-10-14 07:41:39 +01:00
Jeremiah Russell
88fbf74587 ♻️ refactor(cli): use client for trash subcommand
- use the api client for the trash subcommand
2025-10-14 07:41:39 +01:00
Jeremiah Russell
cfd33540aa ♻️ refactor(cli): use gmail client in run_cli
- use gmail client in `run_cli` to avoid passing credentials around
2025-10-14 07:41:39 +01:00
Jeremiah Russell
f79fd2d48c ♻️ refactor(cli): pass client to run command
- pass client to run command to enable api calls
2025-10-14 07:41:39 +01:00
Jeremiah Russell
9bdb559104 ♻️ refactor(cli): use client instance for message subcommand
- use client instance for message subcommand to avoid redundant credential file access
2025-10-14 07:41:39 +01:00
Jeremiah Russell
7eeebddf2e ♻️ refactor(cli): use GmailClient for MessageList
- use GmailClient instance instead of credential file path
- pass GmailClient to add_labels
2025-10-14 07:41:39 +01:00
Jeremiah Russell
704b2b023e 🐛 fix(cli): fix delete command
- pass the client to the delete command
2025-10-14 07:41:39 +01:00
Jeremiah Russell
22e1916262 ♻️ refactor(cli): use GmailClient in delete_cli
- use GmailClient struct instead of credential_file path
- simplifies client handling and avoids redundant credential loading
2025-10-14 07:41:39 +01:00
Jeremiah Russell
04478a13f8 ♻️ refactor(cli): use gmail client for label operations
- replace credential file with gmail client for label operations
- use gmail client to list labels
2025-10-14 07:41:39 +01:00
Jeremiah Russell
4ba9d672a6 ♻️ refactor(cli): remove unused credential file
- remove credential file parameters
- use GmailClient instance instead
2025-10-14 07:41:39 +01:00
Jeremiah Russell
4592daa1cc feat(cli): add execute option to processor
- allow users to skip execution of actions with a new `execute` option
2025-10-12 07:37:54 +01:00
Jeremiah Russell
89dd35d487 feat(cli): add execute flag to run action
- introduce execute flag to control action execution
- add skip_trash flag to skip rules with trash action
- add skip_delete flag to skip rules with delete action
2025-10-12 07:37:54 +01:00
Jeremiah Russell
2110d56331 ♻️ refactor(cli): extract action execution to separate function
- move action execution logic into its own function
- improve readability and maintainability
2025-10-11 09:35:12 +01:00
Jeremiah Russell
6eb86c5d36 feat(cli): add skip action flags to cli
- add flags `--skip-trash` and `--skip-delete` to skip trash and delete actions
- add display order and help heading for better cli usage
2025-10-11 09:35:12 +01:00
Jeremiah Russell
edcc1bbe45 feat(cli): add skip-delete flag to cli
- introduce a new flag `--skip-delete`
- add a new option to skip rules with `delete` action
2025-10-11 09:35:12 +01:00
Jeremiah Russell
1997fd2142 feat(cli): add option to skip trash actions
- introduce `--skip-trash` flag to prevent trashing messages
- add warning log when a trash action is skipped due to the flag
2025-10-11 09:35:12 +01:00
Jeremiah Russell
0bab707b02 ♻️ refactor(trash): refactor trash command
- separates list preparation and trash execution for better modularity
- improves code readability and maintainability
2025-10-11 09:35:12 +01:00
Jeremiah Russell
9fa268340f 🐛 fix(cli): correct count type in add_cli
- fix: change count type from usize to i64 to allow negative values
2025-10-11 09:35:12 +01:00
Jeremiah Russell
1c2e2da031 feat(cli): implement trash and delete actions
- add processor struct to handle gmail api interactions
- implement trash_messages and delete_messages functions in processor
- integrate processor into run_cli to perform actions on messages
2025-10-11 09:35:12 +01:00
Jeremiah Russell
fb7154f752 feat(cli): implement rule execution logic
- add logic to iterate through labels and execute associated rules
- retrieve rules based on label and perform actions like trashing/deleting messages
- log warnings for missing rules or invalid actions
2025-10-11 09:35:12 +01:00
Jeremiah Russell
6a7c67cffc ♻️ refactor(cli): inject config into run command
- inject config into run command for better access to settings
2025-10-11 09:35:12 +01:00
Jeremiah Russell
a1015d9837 feat(cli): add run command to execute rules
- introduce `run` subcommand to trigger rule execution
- implement `RunCli` struct and logic for rule processing
2025-10-11 09:35:12 +01:00
Jeremiah Russell
360c4d6433 feat(cli): add run cli command
- introduce run_cli module with clap integration
- implement basic structure for future command logic
2025-10-11 09:35:12 +01:00
Jeremiah Russell
a3645a5b14 ♻️ refactor(trash): encapsulate message list operations
- move label, query, and max results setting to the message list
- simplify the `TrashCli::run` method
2025-10-09 22:45:24 +01:00
Jeremiah Russell
9baa7a93b9 ♻️ refactor(cli): improve delete command structure
- Refactor the delete command to improve code structure
- Encapsulate message list operations within the MessageList struct
- Enhance readability and maintainability
2025-10-09 22:45:24 +01:00
Jeremiah Russell
bca235a2e7 feat(cli): add delete subcommand
- introduce delete_cli module for handling message deletion
- implement delete subcommand to permanently remove messages
- refactor subcommands to use non-optional enum for improved handling
2025-10-09 22:45:24 +01:00
Jeremiah Russell
7c5b3c807f feat(cli): add delete subcommand
- introduce `delete` subcommand for deleting messages in Gmail
- implement command-line arguments for filtering and executing deletion
- add options for max results, pages, labels, and query
2025-10-09 22:45:24 +01:00
Jeremiah Russell
fdf623ea20 ♻️ refactor(trash): streamline label handling in trash listing
- consolidate label retrieval and addition into `add_labels` method
- improve code clarity and reduce redundancy
2025-10-09 17:03:04 +01:00
Jeremiah Russell
ca06e9290f feat(message): add label support to message listing
- add ability to filter messages by labels
- enhance message listing functionality
2025-10-09 17:03:04 +01:00
Jeremiah Russell
44d8eef872 feat(rules_cli): implement add command for managing retention rules
- add `add` subcommand to manage retention rules
- introduce `Period` enum for specifying time units
- implement logic to add and save new retention rules to the configuration
2025-10-09 17:03:04 +01:00
Jeremiah Russell
801628310b ♻️ refactor(cli): move rm_cli to new directory
- move the rm_cli module from src/config_cli/rules_cli/ to src/cli/config_cli/rules_cli/
2025-10-09 17:03:04 +01:00