-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add SKonsole configuration command and Spectre.Console package #3
Merged
lemillermicrosoft
merged 5 commits into
lemillermicrosoft:main
from
xbotter:feature-config
Aug 15, 2023
Merged
Add SKonsole configuration command and Spectre.Console package #3
lemillermicrosoft
merged 5 commits into
lemillermicrosoft:main
from
xbotter:feature-config
Aug 15, 2023
Conversation
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
✨ Added a new file `ConfigurationProvider.cs` that implements a configuration provider. - The `ConfigurationProvider` class reads and saves configuration settings from a file named `.skonsole` in the user's profile directory. - The configuration settings are stored in a dictionary and can be accessed using the `Get` method. - The `SaveConfig` method allows saving new configuration settings. - The class uses the `Microsoft.Extensions.Configuration` package for configuration management. - The class also includes helper methods for serializing and deserializing JSON. 🔀 Add support for multi-line input in SKonsole ✨ Add support for multi-line input in the SKonsole application by implementing the ReadMutiLineInput() method. This allows users to input multiple lines of text instead of just a single line. The method reads input from the console until an empty line is entered, concatenating each line with a newline character. This change improves the user experience and enables more complex interactions with the application. 📝 Summary: - Added support for multi-line input in SKonsole application - Implemented ReadMutiLineInput() method to read multiple lines from console - Improved user experience and enabled more complex interactions
- Updated the ReadMutiLineInput method in Program.cs to use a StringBuilder instead of string concatenation for better performance. - Replaced the string concatenation with the AppendLine method to correctly handle multiline input. - Trimmed the trailing newline character from the input before returning. This commit fixes the issue with multiline input handling in SKonsole, ensuring that all lines are correctly captured and processed. The changes improve the performance and readability of the code.
🔧 Add Spectre.Console package - Added Spectre.Console package with version 0.47.0 to the project dependencies. ✨ Add ConfigCommand to SKonsole - Added a new ConfigCommand class to SKonsole, which handles skonsole configuration. - The ConfigCommand class has two subcommands: "get" and "set". - The "get" subcommand retrieves the value of a configuration key, while the "set" subcommand sets the value of a configuration key. - The ConfigCommand class includes a RunConfigAsync method, which allows the user to interactively configure the skonsole by selecting a key and setting its value. - The ConfigurationProvider class is updated to include a static Instance property, which provides a singleton instance of the ConfigurationProvider. - The Program.cs file is updated to use the new ConfigCommand class and the ConfigurationProvider.Instance property. - The skonsole configuration keys are hardcoded in the RunConfigAsync method, and the user is prompted to set the values for each key if they are not already set. - The ConfigCommand class and the ConfigurationProvider class are added to the SKonsole.csproj file as project references.
Trim whitespace from the config value before saving it to ensure consistent formatting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Just a few questions for now. Otherwise LGTM. Will try and test it out soon.
lemillermicrosoft
approved these changes
Aug 14, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for contributing!
lemillermicrosoft
added a commit
that referenced
this pull request
Aug 15, 2023
Implement the ConfigCommand class to manage configuration settings in SKonsole. Add get and set commands for handling configuration keys and values. Update ConfigurationProvider to read and write configuration data. Replace the usage of environment variables with configuration variables using the ConfigVar method. Update the error message to instruct users to run `skonsole config` to set the configuration variable. Add a new method ReadMutiLineInput to support multi-line user input in the console. PR: #3 Co-authored-by: xbotter <xbotter@users.noreply.github.com>
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.
Summary:
This pull request updates the SKonsole project with the addition of a new configuration command and the Spectre.Console package. The new "config" command allows users to manage configuration settings for the application, including getting and setting specific configuration keys. The configuration values are stored in a file named ".skonsole". Additionally, the Spectre.Console package is added as a new package reference to enhance the user interface with interactive prompts and colored output.
Changes:
Note: This pull request focuses on adding the new "config" command and its related functionality, as well as integrating the Spectre.Console package for improved user interface. Other changes in the diff are related to existing functionality and are not directly related to the new command.