-
Notifications
You must be signed in to change notification settings - Fork 0
(Entire redo) Major refactor: CLI consolidation + config overhaul #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or 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
- Remove CLI project file entirely as backend now handles command parsing - Remove cssync.Cli from .sln following this change
- Implement `HasTerminal()` with cross-platform TTY checks - Add args support for `--help`, `--enable`, `--disable`, and `--force` - Introduce `ParseInput` helper for handling CLI arguments - Validate terminal requirements before running backend - Provide help text and improved usage feedback
- reorganized shields for GitHub last commit, stars, and repo size - clarified project description removing rclone-specific mention - added a Structure section explaining separation of backend and GUI - updated table to reflect backend logic handling and planned GUI interface - simplified note about backend independence and GUI plans
…c enable/disable - refactored ModifyConfig to use a helper for section/key validation - consolidated type-specific logic for editing, appending, and removing values - updated AppendKey and RemoveKey to support both Variables and Timers sections - added EnableDisableCssync and GetCssyncStatus methods to manage cssync Run state - updated ParseInput to support --status flag and properly enable/disable cssync - removed unused ForceArgument logic and simplified terminal check in Main
- replace inline help text in ParseInput with Resources static strings - introduce Resources.cs to store help, config, rclone and cssync messages - update ParseInput to use central help resources and add --init flag - rename ModifyConfig.GetCssyncStatus() to GetStatus() for consistency - improve unknown flag handling and compatibility error messaging - extend .editorconfig to format json and jsonc files with 2-space indents
- remove legacy cssyncOptions string and unused command scaffolding - change RunCssync signature to no-arg Task to align with upcoming flow - add status check to prevent running when disabled in config - update Program.cs to reference new Cssync.RunCssync usage (currently commented) - leave TODO for future Cssync execution logic
…plify ModifyConfig - Added Newtonsoft.Json dependency for flexible JSON handling - Replaced System.Text.Json with Newtonsoft.Json for serialization/deserialization - Refactored Config class to use a single JObject "Sections" instead of separate Variables/Timers dictionaries - Updated Json helper to handle reading, writing, and generating config using JObject - Updated ModifyConfig to work with JObject for all CRUD operations on config keys and arrays - Simplified Enable/Disable cssync logic and value editing logic - Improved logging for array manipulations and key existence checks - Removed redundant try/catch blocks where validation handles errors - Updated GetStatus/GetConfigStatus and other methods to align with new JObject structure
- Refined HelpConfig text for clarity and conciseness - Simplified explanations of "Run", "Variables", and "Timers" - Updated examples and formatting for easier reading - Included guidance for rclone setup with links - Added 'builds' folder to .gitignore to ignore local build artifacts
… config - Cssync.RunCssync now monitors config and stops automatically if "Run" is false - Introduced CancellationToken and background task loop (CssyncLoop) - Added Json.Serialize helper for future use
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(forced everything back, redoing entire process)
Description
This PR implements a major architectural refactor of the cssync project, consolidating the CLI functionality into the backend, overhauling the configuration system, and introducing a more flexible and maintainable codebase. The changes remove the separate CLI project, streamline configuration handling with Newtonsoft.Json, and implement a robust command-line interface directly within the backend.
The refactor improves maintainability by reducing project complexity, enhances configuration flexibility with a dynamic JObject structure, and provides better cross-platform support through improved terminal detection and execution flow.
Changes
New Features
cssync.Cliproject and integrated CLI functionality directly intocssync.BackendJObject-based sections using Newtonsoft.JsonParseInput.cswith categorized help systemCssync.csthat dynamically responds to configuration changesRemoved Features
cssync.Cliproject and all associated filesVariablesandTimerdictionaries with flexibleSectionsJObjectImprovements
Json.csto use Newtonsoft.Json with dynamicJObjectsections instead of static dictionariesModifyConfig.csto work with the new JObject-based configuration structureResources.cswith detailed configuration guidancecssync.slnto remove CLI project reference and cleaned up solution configuration--help configcommandBug Fixes
MainBackend.Main()to prevent incorrect command execution.gitignoreto properly exclude build artifacts and added missing patternsOther
.editorconfigto include JSON and JSONC files with consistent indentation rulesAdditional Information
Breaking Changes
SectionsstructureMigration Notes
cssync --initChecklist