-
Notifications
You must be signed in to change notification settings - Fork 13
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
comments and list #2
Comments
comments are not standard in json so they are a bit picky to parse which is why I added the space. You've noticed the difference as well between Windows PowerShell and PowerShell 7. I might revisit this to see if there is a better way. |
I'm working on a fix to better handle the settings file. You'll see it in v1.6.0 |
v1.6.0 has been released to the PowerShell Gallery which should address these issues. |
Huh, I just updated to v1.6.0, and Powershell 7.0.2 still works as before, but now in Powershell 5 I get: ConvertFrom-Json : Invalid JSON primitive: .
I don't see anywhere in my settings.json file where I have '//' without a space afterwards, unless it is in some of the URLs for icons.... |
JSON in Windows PowerShell is wacky. Can you post your settings file so I can test with it? |
Here's my settings.json file. |
The json cmdlet in Windows PowerShell is very picky. There's nothing "wrong" with your settings file. The same command works just fine in PS 7. |
This will work in Windows PowerShell: get-content .\settings.json | where {$_ -notmatch "//"} | convertfrom-json |
That didn't quite seem to do it, but when I changed the existing line to be this $obj = (Get-Content -path $Global:WTSettingsPath).where({$_ -notmatch "^[\t ]*//"}) | ConvertFrom-Json it all seems to work ok. Thanks for the help! |
I don't necessarily put a space after // for comments in my settings.json file. convertfrom-json is more forgiving in powershell 7 than powershell 5 for this. But I've added spaces to work with this module.
This is more on me, but I had copied the defaults.json to settings.json, and it doesn't have a 'list' property, so get-wtcurrent wasn't finding the current profile. I've started over with the settings.json that comes with it.
Btw I like having the settings folder for easy cd:
$WTSettingsFolder = split-path $WTSettingsPath
The text was updated successfully, but these errors were encountered: