Add settings import to command line #13791

Open
opened 2026-01-31 03:52:11 +00:00 by claunia · 6 comments
Owner

Originally created by @wolf99 on GitHub (May 12, 2021).

Description of the new feature/enhancement

Command line argument allowing the import of new settings files.

This would make scripting of environment setup a bit less fiddly.

Something like

> wt import mySettings.json
Settings imported successfully

Potentially could validate settings during import to prevent overwriting existing settings with invalid ones

> wt import myDodgySettings.json
Settings not valid, import failed.
Ln # 8: "HoopyFrood" is not a valid setting
Ln # 9: "KnowsWhereHisTowelIs" is an unknown value for setting "ArthurDent"
    Acceptable values are "Confused", "Bewildered", or "JustWantsANiceCupOfTea".

If getting really fancy, the command could update valid but older settings to newer schemas

> wt import myValidButOldSettings.json
Whoa, there Magrathean, those settings look a little stale!
Settings updated to new schema
Settings imported successfully
Originally created by @wolf99 on GitHub (May 12, 2021). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> # Description of the new feature/enhancement Command line argument allowing the import of new settings files. This would make scripting of environment setup a bit less fiddly. Something like ```console > wt import mySettings.json Settings imported successfully ``` Potentially could validate settings during import to prevent overwriting existing settings with invalid ones ```console > wt import myDodgySettings.json Settings not valid, import failed. Ln # 8: "HoopyFrood" is not a valid setting Ln # 9: "KnowsWhereHisTowelIs" is an unknown value for setting "ArthurDent" Acceptable values are "Confused", "Bewildered", or "JustWantsANiceCupOfTea". ```` If getting really fancy, the command could update valid but older settings to newer schemas ```console > wt import myValidButOldSettings.json Whoa, there Magrathean, those settings look a little stale! Settings updated to new schema Settings imported successfully ```
claunia added the Issue-FeatureNeeds-Tag-FixArea-Commandline labels 2026-01-31 03:52:11 +00:00
Author
Owner

@DHowett commented on GitHub (May 13, 2021):

Thanks for the request! We've got a request for supporting import/export for color schemes, and we don't hate the idea . . . but we're wondering what value it adds over "copy the file over the existing settings.json"?

😄

@DHowett commented on GitHub (May 13, 2021): Thanks for the request! We've got a request for supporting import/export for color schemes, and we don't _hate_ the idea . . . but we're wondering what value it adds over "copy the file over the existing settings.json"? :smile:
Author
Owner

@DHowett commented on GitHub (May 13, 2021):

(@miniksa suggests that finding the path to the settings file "sucks")

@DHowett commented on GitHub (May 13, 2021): (@miniksa suggests that finding the path to the settings file "sucks")
Author
Owner

@wolf99 commented on GitHub (May 14, 2021):

I agree with @miniksa 😊, finding the path is at best non-intuitive.

Additionally the path is fugly, but more importantly it includes your username. For most users this is their actual name. I don't really want that in scripts that are in remote SCM systems or the like.

Further, using an action rather than a path abstracts the path so that WT can change the underlying path used as it may need, e.g. for preview WT vs main WT vs dev WT vs user installation vs system installation, etc.

> wt import --preview --user localTestSettings.json
Settings imported to user installation of terminal preview

I added the extra functionality (validation, etc) in the request just for fun really, but they could be facilitated in such a feature. This would mean that the person doing the configuring (who may not be the same person as the user), can easily know if settings are valid without needing to open the application.

WRT color scheme import, that's a whole other thing IMHO. The imported values would of course end up in the settings.json, and may also need some validation. But I imagine that relates to opening up to the large color profiles community who may not appreciate needing to include the other, non-color related, WT settings in such profiles if these two features were one and the same thing.

@wolf99 commented on GitHub (May 14, 2021): I agree with @miniksa 😊, finding the path is at best non-intuitive. Additionally the path is fugly, but more importantly it includes your username. For most users this is their actual name. I don't really want that in scripts that are in remote SCM systems or the like. Further, using an action rather than a path abstracts the path so that WT can change the underlying path used as it may need, e.g. for preview WT vs main WT vs dev WT vs user installation vs system installation, etc. ```console > wt import --preview --user localTestSettings.json Settings imported to user installation of terminal preview ``` I added the extra functionality (validation, etc) in the request just for fun really, but they could be facilitated in such a feature. This would mean that the person doing the configuring (who may not be the same person as the user), can easily know if settings are valid without needing to open the application. WRT color scheme import, that's a whole other thing IMHO. The imported values would of course end up in the settings.json, and may also need some validation. But I imagine that relates to opening up to the large color profiles community who may not appreciate needing to include the other, non-color related, WT settings in such profiles if these two features were one and the same thing.
Author
Owner

@KalleOlaviNiemitalo commented on GitHub (May 14, 2021):

> wt import mySettings.json
Settings imported successfully

Outputting that to the console of the parent process would have the same difficulties as wt --help in https://github.com/microsoft/terminal/issues/7258. Just providing an exit code for batch files seems easier, though; even if it ends up requiring something ugly like START /WAIT wt --wait import mySettings.json.

@KalleOlaviNiemitalo commented on GitHub (May 14, 2021): ``` > wt import mySettings.json Settings imported successfully ``` Outputting that to the console of the parent process would have the same difficulties as `wt --help` in <https://github.com/microsoft/terminal/issues/7258>. Just providing an exit code for batch files seems easier, though; even if it ends up requiring something ugly like `START /WAIT wt --wait import mySettings.json`.
Author
Owner

@wolf99 commented on GitHub (May 15, 2021):

Yeah, exit codes to be preferred.
The sample outputs I've shown here are more to show different functionality for the purposes if this thread only.

I didn't realise there were problems for WT outputting on command line. Even for my sample outputs, I intended that they would be responses in the CLI rather than a modal or the like.

@wolf99 commented on GitHub (May 15, 2021): Yeah, exit codes to be preferred. The sample outputs I've shown here are more to show different functionality for the purposes if this thread only. I didn't realise there were problems for WT outputting on command line. Even for my sample outputs, I intended that they would be responses in the CLI rather than a modal or the like.
Author
Owner

@zadjii-msft commented on GitHub (Jun 6, 2024):

As noted in #17329, we probably want to support YAML from https://www.commands.dev/ as well.

@zadjii-msft commented on GitHub (Jun 6, 2024): As noted in #17329, we probably want to support YAML from https://www.commands.dev/ as well.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13791