@@ -197,16 +197,19 @@ WinGet configuration enables you to install Oh My Posh and apply configuration i
197197Create a configuration file to install and configure Oh My Posh:
198198
199199``` yaml title="oh-my-posh-setup.yaml"
200- $schema : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3 /config/document.json
200+ $schema : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08 /config/document.json
201201metadata :
202202 winget :
203- processor : dscv3
204- resources :
205- - name : Install Oh My Posh
206- type : Microsoft.WinGet.DSC/WinGetPackage
207- properties :
208- id : JanDeDobbeleer.OhMyPosh
209- source : winget
203+ processor :
204+ identifier : dscv3
205+ - type : Microsoft.WinGet/Package
206+ name : OhMyPosh
207+ properties :
208+ id : JanDeDobbeleer.OhMyPosh
209+ source : winget
210+ useLatest : true
211+ metadata :
212+ description : Install Oh My Posh
210213` ` `
211214
212215Apply the configuration:
@@ -220,31 +223,44 @@ winget configure oh-my-posh-setup.yaml
220223This example installs Oh My Posh, adds your configuration, and initializes PowerShell:
221224
222225``` yaml title="oh-my-posh-complete.yaml"
223- $schema : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3 /config/document.json
226+ $schema : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08 /config/document.json
224227metadata :
225228 winget :
226- processor : dscv3
229+ processor :
230+ identifier : dscv3
227231resources :
228- - name : Install Oh My Posh
229- type : Microsoft.WinGet.DSC/WinGetPackage
230- properties :
231- id : JanDeDobbeleer.OhMyPosh
232- source : winget
233-
234- - name : Add Oh My Posh configuration
235- type : OhMyPosh/Config
236- properties :
237- states :
238- - source : ~/mytheme.omp.json
239- format : json
240-
241- - name : Initialize PowerShell
242- type : OhMyPosh/Shell
243- properties :
244- states :
245- - name : pwsh
246- command : oh-my-posh init pwsh --config ~/mytheme.omp.json
247- skipExistingInit : true
232+ - type : Microsoft.WinGet/Package
233+ name : OhMyPosh
234+ properties :
235+ id : JanDeDobbeleer.OhMyPosh
236+ source : winget
237+ useLatest : true
238+ metadata :
239+ description : Install Oh My Posh
240+
241+ - type : OhMyPosh/Config
242+ name : OhMyPoshConfiguration
243+ dependsOn :
244+ - OhMyPosh
245+ properties :
246+ states :
247+ - source : ~/mytheme.omp.json
248+ format : json
249+ version : 3
250+ metadata :
251+ description : Add Oh My Posh configuration
252+
253+ - type : OhMyPosh/Shell
254+ name : OhMyPoshInitializePowerShell
255+ dependsOn :
256+ - OhMyPoshConfiguration
257+ properties :
258+ states :
259+ - name : pwsh
260+ command : oh-my-posh init pwsh --config ~/mytheme.omp.json
261+ skipExistingInit : true
262+ metadata :
263+ description : Initialize PowerShell
248264` ` `
249265
250266Apply with:
@@ -258,44 +274,68 @@ winget configure oh-my-posh-complete.yaml
258274Initialize multiple shells with different configurations:
259275
260276``` yaml title="oh-my-posh-multi-shell.yaml"
261- $schema : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/v3 /config/document.json
277+ $schema : https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08 /config/document.json
262278metadata :
263279 winget :
264- processor : dscv3
280+ processor :
281+ identifier : dscv3
265282resources :
266- - name : Install Oh My Posh
267- type : Microsoft.WinGet.DSC/WinGetPackage
268- properties :
269- id : JanDeDobbeleer.OhMyPosh
270- source : winget
271-
272- - name : Add work configuration
273- type : OhMyPosh/Config
274- properties :
275- states :
276- - source : ~/work-theme.omp.json
277- format : json
278-
279- - name : Add personal configuration
280- type : OhMyPosh/Config
281- properties :
282- states :
283- - source : ~/personal-theme.omp.json
284- format : json
285-
286- - name : Initialize PowerShell with work configuration
287- type : OhMyPosh/Shell
288- properties :
289- states :
290- - name : pwsh
291- command : oh-my-posh init pwsh --config ~/work-theme.omp.json
292-
293- - name : Initialize Bash with personal configuration
294- type : OhMyPosh/Shell
295- properties :
296- states :
297- - name : bash
298- command : oh-my-posh init bash --config ~/personal-theme.omp.json
283+ - type : Microsoft.WinGet/Package
284+ name : OhMyPosh
285+ properties :
286+ id : JanDeDobbeleer.OhMyPosh
287+ source : winget
288+ useLatest : true
289+ metadata :
290+ description : Install Oh My Posh
291+
292+ - type : OhMyPosh/Config
293+ name : OhMyPoshWorkConfiguration
294+ dependsOn :
295+ - OhMyPosh
296+ properties :
297+ states :
298+ - source : ~/work-theme.omp.json
299+ format : json
300+ version : 3
301+ metadata :
302+ description : Add Oh My Posh work configuration
303+
304+ - type : OhMyPosh/Config
305+ name : OhMyPoshPersonalConfiguration
306+ dependsOn :
307+ - OhMyPosh
308+ properties :
309+ states :
310+ - source : ~/personal-theme.omp.json
311+ format : json
312+ version : 3
313+ metadata :
314+ description : Add Oh My Posh personal configuration
315+
316+ - type : OhMyPosh/Shell
317+ name : OhMyPoshInitializePowerShell
318+ dependsOn :
319+ - OhMyPoshWorkConfiguration
320+ properties :
321+ states :
322+ - name : pwsh
323+ command : oh-my-posh init pwsh --config ~/work-theme.omp.json
324+ skipExistingInit : true
325+ metadata :
326+ description : Initialize PowerShell with work configuration
327+
328+ - type : OhMyPosh/Shell
329+ name : OhMyPoshInitializeBash
330+ dependsOn :
331+ - OhMyPoshPersonalConfiguration
332+ properties :
333+ states :
334+ - name : bash
335+ command : oh-my-posh init bash --config ~/personal-theme.omp.json
336+ skipExistingInit : true
337+ metadata :
338+ description : Initialize Bash with personal configuration
299339` ` `
300340
301341## Orchestration with Microsoft DSC
@@ -308,21 +348,33 @@ resources that can be used in DSC configuration documents.
308348Create a configuration document for Oh My Posh :
309349
310350` ` ` yaml title="oh-my-posh-dsc.yaml"
311- $schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
351+ $schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
352+ metadata:
353+ winget:
354+ processor:
355+ identifier: dscv3
312356resources:
313- - name: Add Oh My Posh configuration
314- type: OhMyPosh/Config
315- properties:
316- states:
317- - source: ~/mytheme.omp.json
318- format: json
319-
320- - name: Initialize PowerShell
321- type: OhMyPosh/Shell
322- properties:
323- states:
324- - name: pwsh
325- command: oh-my-posh init pwsh --config ~/mytheme.omp.json
357+ - type: OhMyPosh/Config
358+ name: OhMyPoshConfiguration
359+ properties:
360+ states:
361+ - source: ~/mytheme.omp.json
362+ format: json
363+ version: 3
364+ metadata:
365+ description: Add Oh My Posh configuration
366+
367+ - type: OhMyPosh/Shell
368+ name: OhMyPoshInitializePowerShell
369+ dependsOn:
370+ - OhMyPoshConfiguration
371+ properties:
372+ states:
373+ - name: pwsh
374+ command: oh-my-posh init pwsh --config ~/mytheme.omp.json
375+ skipExistingInit: true
376+ metadata:
377+ description: Initialize PowerShell
326378` ` `
327379
328380Apply the configuration using the `dsc` CLI :
@@ -334,42 +386,67 @@ dsc config set --document oh-my-posh-dsc.yaml
334386# ## Complete configuration with multiple shells
335387
336388` ` ` yaml title="oh-my-posh-complete-dsc.yaml"
337- $schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
389+ $schema: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2023/08/config/document.json
390+ metadata:
391+ winget:
392+ processor:
393+ identifier: dscv3
338394resources:
339- - name: Add primary configuration
340- type: OhMyPosh/Config
341- properties:
342- states:
343- - source: ~/primary-theme.omp.json
344- format: json
345-
346- - name: Add secondary configuration
347- type: OhMyPosh/Config
348- properties:
349- states:
350- - source: ~/secondary-theme.omp.json
351- format: yaml
352-
353- - name: Initialize PowerShell
354- type: OhMyPosh/Shell
355- properties:
356- states:
357- - name: pwsh
358- command: oh-my-posh init pwsh --config ~/primary-theme.omp.json
359-
360- - name: Initialize Bash
361- type: OhMyPosh/Shell
362- properties:
363- states:
364- - name: bash
365- command: oh-my-posh init bash --config ~/primary-theme.omp.json
366-
367- - name: Initialize Zsh
368- type: OhMyPosh/Shell
369- properties:
370- states:
371- - name: zsh
372- command: oh-my-posh init zsh --config ~/secondary-theme.omp.json
395+ - type: OhMyPosh/Config
396+ name: OhMyPoshPrimaryConfiguration
397+ properties:
398+ states:
399+ - source: ~/primary-theme.omp.json
400+ format: json
401+ version: 3
402+ metadata:
403+ description: Add primary configuration
404+
405+ - type: OhMyPosh/Config
406+ name: OhMyPoshSecondaryConfiguration
407+ properties:
408+ states:
409+ - source: ~/secondary-theme.omp.json
410+ format: json
411+ version: 3
412+ metadata:
413+ description: Add secondary configuration
414+
415+ - type: OhMyPosh/Shell
416+ name: OhMyPoshInitializePowerShell
417+ dependsOn:
418+ - OhMyPoshPrimaryConfiguration
419+ properties:
420+ states:
421+ - name: pwsh
422+ command: oh-my-posh init pwsh --config ~/primary-theme.omp.json
423+ skipExistingInit: true
424+ metadata:
425+ description: Initialize PowerShell
426+
427+ - type: OhMyPosh/Shell
428+ name: OhMyPoshInitializeBash
429+ dependsOn:
430+ - OhMyPoshPrimaryConfiguration
431+ properties:
432+ states:
433+ - name: bash
434+ command: oh-my-posh init bash --config ~/primary-theme.omp.json
435+ skipExistingInit: true
436+ metadata:
437+ description: Initialize Bash
438+
439+ - type: OhMyPosh/Shell
440+ name: OhMyPoshInitializeZsh
441+ dependsOn:
442+ - OhMyPoshSecondaryConfiguration
443+ properties:
444+ states:
445+ - name: zsh
446+ command: oh-my-posh init zsh --config ~/secondary-theme.omp.json
447+ skipExistingInit: true
448+ metadata:
449+ description: Initialize Zsh
373450` ` `
374451
375452# ## Resource Types
0 commit comments