-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Argument Parsing Using a Function Map for Enhanced Modularity
- Function Map (std::unordered_map): Each argument is now directly associated with a specific function, improving clarity and reducing code complexity. Eliminated multiple if-else statements for better readability. Added extensibility: introducing new arguments is as simple as extending the argHandlers map. - Modularity: Encapsulated the logic for each argument into dedicated lambda functions. Decoupled functions like showHelp and checkupdate for cleaner design. - Error Handling: Integrated std::filesystem to validate directory paths. Added error messages and immediate termination for unrecognized arguments. - Extensibility: Simplified the process of adding arguments by centralizing control in argHandlers. - Centralized Flag Management: Directly manage flags (parameAFlag, parameDFlag, etc.) within the lambda functions of the map.
- Loading branch information
Showing
1 changed file
with
35 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters