Commit Graph

803 Commits

Author SHA1 Message Date
Jeremiah Russell
572a01e8dd 🐛 fix(error): refine error message for rule selector
- clarify that the rule selector can be either --id or --label
2025-10-08 16:33:31 +01:00
Jeremiah Russell
16145f8b22 feat(rules_cli): implement rule removal
- add `rm` subcommand to remove rules by id or label
- add `id` and `label` options to `rm` subcommand
- implement `remove_rule_by_id` and `remove_rule_by_label` in `Config`
2025-10-08 16:25:06 +01:00
Jeremiah Russell
6df0ef6536 ♻️ refactor(config): enhance EolRule for label management
- migrate labels from Vec to BTreeSet for uniqueness and order
- add `remove_label` function to remove specific labels
- change `labels()` function return type from `&Vec<String>` to `Vec<String>`
- implement `Clone` trait for `EolRule`
2025-10-08 16:25:06 +01:00
Jeremiah Russell
80c8bbc863 feat(lib): introduce Result type alias for error handling
- add `Result` type alias for cleaner error handling throughout the crate
2025-10-08 16:25:06 +01:00
Jeremiah Russell
3aa76a20a8 feat(error): add custom error types for rule selection
- introduce `NoRuleSelector`, `NoRuleFoundForLabel`, and `LabelNotFoundInRules` errors
- these errors provide more specific feedback when rule selection fails
2025-10-08 16:25:06 +01:00
Jeremiah Russell
662d08ba4f feat(config): enhance rule management and label handling
- change rules storage from BTreeMap<String, EolRule> to BTreeMap<usize, EolRule>
- implement functions to remove rules by ID or label
- add helper functions to retrieve labels and rules associated with labels
- improve error handling for missing labels or rules
2025-10-08 16:25:06 +01:00
Jerus Bot
0ba04b2077 chore: update prlog for pr 2025-10-08 16:25:06 +01:00
Jeremiah Russell
0a1187eaf5 feat(rules_cli): implement rm_cli subcommand
- add `rm_cli` subcommand structure with clap
- implement basic `run` function for `rm_cli`
2025-10-08 16:25:06 +01:00
Jeremiah Russell
476f5d245e feat(rules_cli): add remove command to rules cli
- add remove command to rules cli
- create rm_cli module
2025-10-08 16:25:06 +01:00
Jerus Bot
aee8f87da3 chore: update prlog for pr 2025-10-08 12:20:34 +01:00
Jeremiah Russell
b47629d076 🐛 fix(eol_rule): correct rule description in to_string method
- fix the inaccurate description in the `to_string` method for `EolRule`
- correct the description to properly display that the rule moves the message to trash
2025-10-08 12:20:34 +01:00
Jeremiah Russell
0bca3ed6f9 feat(rules_cli): add option to immediately delete rules
- add `delete` flag to `add` command
- allow immediate deletion of rules instead of moving to trash
2025-10-08 12:20:34 +01:00
Jeremiah Russell
5096fd2b19 ♻️ refactor(config): rename EolCmd to EolAction for clarity
- rename `command` field in `EolRule` to `action`
- update `set_command` method to use `EolAction` enum
- adjust display formatting to reflect the change to "action"
2025-10-08 12:20:34 +01:00
Jeremiah Russell
68b6cba9c1 ♻️ refactor(core): rename EolCmd to EolAction
- clarifies the purpose as an action to be performed at the end of life
2025-10-08 12:20:34 +01:00
Jeremiah Russell
c81cd6d6cc feat(config): add delete flag for retention rules
- allow retention rules to be configured to delete messages
- add `delete` flag to `add_rule` function
- add `set_command` function to `EolRule` to set the action to delete
2025-10-08 12:20:34 +01:00
Jerus Bot
9737ef4b7d chore: update prlog for pr 2025-10-08 11:40:55 +01:00
Jeremiah Russell
4830d95a76 feat(rules_cli): add optional label for retention rules
- allows users to specify a custom label when adding a retention rule
- if no label is provided, a unique one will be generated automatically
2025-10-08 11:40:55 +01:00
Jeremiah Russell
432c1635af feat(config): add labels method to EolRule
- add `labels` method to `EolRule` to access labels vector
2025-10-08 11:40:55 +01:00
Jeremiah Russell
cf3d93cf13 feat(config): add support for labels to retention rules
- allow associating labels with retention rules for more granular control
- add label parameter to `add_rule` function
- check for duplicate rules and labels before adding new ones
2025-10-08 11:40:55 +01:00
Jerus Bot
5da589678e chore: update prlog for pr 2025-10-08 10:39:38 +01:00
Jeremiah Russell
5c42c0f66d feat(config): add retention attribute to EolRule
- introduce retention attribute in EolRule struct
- implement getter method for accessing retention value
2025-10-08 10:39:38 +01:00
Jeremiah Russell
7610f2a9dc feat(config): enhance rule management with BTreeMap
- migrate rules from Vec to BTreeMap for efficient access
- add rule existence check to prevent duplicates
- improve rule listing by iterating over values
2025-10-08 10:39:38 +01:00
Jerus Bot
b637d249a9 chore: update prlog for pr 2025-10-08 07:56:41 +01:00
Jeremiah Russell
c1ab9a5333 feat(rules_cli): implement add command
- add `add` subcommand to create new retention rules
- allow specifying period and count for message age
- support generating labels for new rules
2025-10-08 07:56:41 +01:00
Jeremiah Russell
7b08bfe13a feat(retention): add message age enum creation
- implement `new` function for MessageAge enum
- allow creating MessageAge from string period and count
2025-10-08 07:56:41 +01:00
Jeremiah Russell
b729ee6a10 feat(rules): add subcommand for rule management
- introduce RulesCli to handle rule management commands
- implement `add` subcommand with `AddCli` to add rules to the config
2025-10-08 07:56:41 +01:00
Jeremiah Russell
92e88c4261 📝 docs(retention): add documentation for the retention struct
- add documentation for the `new` function
2025-10-08 07:56:41 +01:00
Jeremiah Russell
19513f51a9 🐛 fix(rules): fix config_cli.run to return a Result
- fix the config_cli.run function to return a Result to handle potential errors
2025-10-08 07:56:41 +01:00
Jeremiah Russell
c1e42dfa50 feat(config): add result type to list_rules function
- modify list_rules to return a Result type
- allows for error handling during rule listing
2025-10-08 07:56:41 +01:00
Jeremiah Russell
6b1dedc10a 🐛 fix(config): correct pluralization of time periods in EolRule display
- fix pluralization logic for day, week, month, and year
- avoid redundant match arms by pushing 's' when count > 1
2025-10-08 06:42:29 +01:00
Jerus Bot
739f7e69f5 chore: update prlog for pr 2025-10-08 06:42:29 +01:00
Jeremiah Russell
bebf00acb4 ♻️ refactor(cli): restructure cli commands and config handling
- rename config cli to rules cli for better clarity
- move config loading to rules cli for better modularity
- update command matching to use the new rules cli
2025-10-08 06:42:29 +01:00
Jeremiah Russell
90383226aa 🐛 fix(message_age): correct retention label formatting
- fix format string for weeks, months and years
2025-10-08 06:42:29 +01:00
Jeremiah Russell
9e547b62e7 feat(config): implement display for eolrule struct
- add display trait implementation for eolrule struct to provide a user-friendly representation of the rule's configuration
- the display format includes the rule id, labels, and retention period, making it easier to understand the rule's settings
2025-10-08 06:42:29 +01:00
Jeremiah Russell
6ef1a337a2 feat(config): add function to list rules
- implement list_rules function in Config struct
- iterate through rules and print each rule
2025-10-08 06:42:29 +01:00
Jeremiah Russell
33027a6c34 ♻️ refactor(cli): rename config_cli to rules_cli
- rename config_cli to rules_cli for better clarity
- rename ConfigCommands to RulesCommands for better clarity
- rename ConfigCli to RulesCli for better clarity
2025-10-08 06:42:29 +01:00
Jerus Bot
39da683fc0 chore: update prlog for pr 2025-10-07 17:34:19 +01:00
Jeremiah Russell
7a1a8f6a1a 🐛 fix(ui): correct grammar errors in eol command and trash messages
- fix typo in `Delete` variant description from "immediatly" to "immediately"
- correct grammar in trash log message from "move to trash" to "moved to trash"
2025-10-07 17:34:19 +01:00
Jerus Bot
ed00ab698e chore: update prlog for pr 2025-10-07 15:59:18 +01:00
Jeremiah Russell
050f00940b feat(config): implement configuration file management
- add config.rs to handle program configuration
- create default configuration with retention rules
- implement save and load functions for persistent storage
- add credential file setting
2025-10-07 15:59:18 +01:00
Jeremiah Russell
17dc58c4a7 feat(retention): introduce message age enum
- add MessageAge enum to represent retention periods in days, weeks, months, or years
- implement Display trait for MessageAge to format retention periods
- implement label function to generate retention label
2025-10-07 15:59:18 +01:00
Jeremiah Russell
e77b372413 feat(config): add EolRule struct for managing end-of-life rules
- introduce EolRule struct with fields for id, retention, labels, query, and command
- implement methods for creating new rules, setting retention, and adding labels
- add default implementation for EolRule
2025-10-07 15:59:18 +01:00
Jeremiah Russell
f63a0f888d feat(retention): implement data retention policy
- introduce `Retention` struct to define data retention period and label generation flag
- add `MessageAge` enum to represent different retention time units (days, months, years)
- implement default values for retention policy (5 years, generate label)
2025-10-07 15:59:18 +01:00
Jeremiah Russell
4390fe4c2d feat(cli): load configuration for message command
- load config file instead of hardcoding credential path
- create default config if not exist
2025-10-07 15:59:18 +01:00
Jeremiah Russell
ab8df6bdd9 feat(lib): add config and retention modules
- add config module for managing application settings
- add retention module for message age management
2025-10-07 15:59:18 +01:00
Jeremiah Russell
c4e4e28f66 🐛 fix(error): refine error handling with granular variants
- introduce specific error variants for std::io::Error and toml::de::Error
- remove commented-out error variants to streamline error reporting
2025-10-07 15:59:18 +01:00
Jeremiah Russell
1bbc75206a feat(eol_cmd): introduce EolCmd enum for message disposal
- add Trash and Delete variants for specifying end-of-life actions
- implement Display trait for EolCmd to provide string representation
2025-10-07 15:59:18 +01:00
Jeremiah Russell
9c4e1c989d 🔧 chore(vscode): update disabled rules for ltex extension
- add new rules to improve code quality and consistency
2025-10-07 15:59:18 +01:00
Jeremiah Russell
b960436a9f 📦 build(deps): add toml dependency
- add toml crate for configuration file parsing
2025-10-07 15:59:18 +01:00
Jeremiah Russell
122d000d6b feat(build): add toml dependency
- add toml crate for configuration file parsing
2025-10-07 15:59:18 +01:00