PoshCode / Configuration

A module to help other modules have settings
MIT License
176 stars 27 forks source link

Exported scriptblocks including a single-quoted string fail to reimport #29

Closed Chirishman closed 5 years ago

Chirishman commented 5 years ago

Found when using PowerLine.

Original Issue: https://github.com/Jaykul/PowerLine/issues/42

When I run this interactively it works, however when I export it and reopen PowerShell and reimport PowerLine it throws at line 6.

Looking at it more closely it looks like it's some kind of bug in the Configuration module maybe? Or maybe just in the export command. Let me know if you'd rather track this on Configuration.

https://gist.github.com/Chirishman/ad7ab9492f9972d77536e89fb1f02053

Error:

Import-Metadata : Exception calling "Create" with "1" argument(s): "At line:1 char:63
+ New-PromptText -Fg White -Bg 20 (((Get-SegmentedPath) -replace
+                                                               ~
You must provide a value expression following the '-replace' operator.
At line:1 char:63
+ New-PromptText -Fg White -Bg 20 (((Get-SegmentedPath) -replace
+                                                               ~
Missing closing ')' in expression."
At C:\Program Files\WindowsPowerShell\Modules\Configuration\1.3.1\Configuration.psm1:417 char:21
+ ...             Import-Metadata $EnterprisePath -ErrorAction Ignore -Orde ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Import-Metadata], MethodInvocationException
    + FullyQualifiedErrorId : ParseException,Import-Metadata
Jaykul commented 5 years ago

Fixed in 1136eb7c just need to get the build straight and do the release...