Skip to content

Refactor: deduplicate code and improve maintainability#6

Merged
Glubiz merged 1 commit into
mainfrom
improve-maintainability
Feb 24, 2026
Merged

Refactor: deduplicate code and improve maintainability#6
Glubiz merged 1 commit into
mainfrom
improve-maintainability

Conversation

@Glubiz
Copy link
Copy Markdown
Owner

@Glubiz Glubiz commented Feb 24, 2026

Summary

  • Extract shared utilities (constants, types, functions) into utils.rs to eliminate duplication across modules
  • Deduplicate script search logic in input.rs and script listing in help.rs via helper functions
  • Change Command.execute() to take &self instead of &mut self, removing unnecessary struct cloning
  • Fix is_some()/unwrap() anti-pattern with proper pattern matching
  • Bump version to 2.1.0

Test plan

  • All 13 existing tests pass
  • Clippy clean
  • Formatting verified

- Extract shared constants, Shortcuts struct, home_dir(), and parse_script_content() into utils.rs
- Deduplicate script search logic in input.rs via find_script_in_dir() helper
- Deduplicate script listing and shortcut display in help.rs via write_scripts()/write_shortcuts() helpers
- Change Command.execute() from &mut self to &self, eliminating unnecessary full struct clone
- Replace is_some()/unwrap() with proper pattern matching in script.rs
- Unify home directory resolution across all modules
- Bump version to 2.1.0
@Glubiz Glubiz self-assigned this Feb 24, 2026
@Glubiz Glubiz merged commit a2b6a18 into main Feb 24, 2026
1 check 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.

1 participant