-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Export command for winget settings. #2719
Export command for winget settings. #2719
Conversation
|
||
void ExportAdminSettings(Execution::Context& context) | ||
{ | ||
AdminSetting settings[] = |
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.
This would be better if there were a Max
enum value and we could just enumerate for (i = firstValidSetting; i < AdminSetting::Max; ++i)
so that any future settings are automatically included.
void SettingsExportCommand::ExecuteInternal(Execution::Context& context) const | ||
{ | ||
context << | ||
Workflow::EnsureRunningAsAdmin << |
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.
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.
There's no real reason. Removing.
{ | ||
AdminSettings() | ||
{ | ||
root["adminSettings"] = Json::ValueType::objectValue; |
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.
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.
For DSC... not entirely. The admin settings resource will take a hashtable with something really similar to value of the adminSettings. We just needed a way to expose it without reading registry keys.
Also, because reasons (mostly testing and not having to special case powershell) I'm adding the path of the local user settings file to winget settings export
. Also winget --info
for completeness.
But yes, I'm going to add a new schema.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@@ -193,6 +193,7 @@ namespace AppInstaller::CLI | |||
}; | |||
|
|||
info << std::endl << Resource::String::Logs << ": "_liv << Runtime::GetPathTo(Runtime::PathName::DefaultLogLocationForDisplay).u8string() << std::endl; | |||
info << std::endl << Resource::String::UserSettings << ": "_liv << Runtime::GetPathTo(Runtime::PathName::UserSettingsFileLocation).u8string() << std::endl; |
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.
info << std::endl << Resource::String::UserSettings << ": "_liv << Runtime::GetPathTo(Runtime::PathName::UserSettingsFileLocation).u8string() << std::endl;
We may need to remember to update this one when #2454 is merged
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.
Add new command for
winget settings export
. This command will report the value of the winget admin settings formatted as json, as well as the path of the user settings file.Also adding the user settings json path in
winget --info
for completeness.In preparation of #2697
Microsoft Reviewers: Open in CodeFlow