Skip to content

Add Powershell and CMD wrappers #841

Open
@phreed

Description

@phreed

There are issues with escaping evaluation strings on Windows. see #747 #777 et al.
Add a yq.ps1 file

Param(
    [string]$command,
    [string]$yamlFile
  )
$escCommand =  $command -replace '"','\"' 
$evalArgs = @("eval", "$escCommand", $yamlFile)

Write-Output ".\yq.exe"  $evalArgs
& ".\yq.exe"  $evalArgs

alternatives

Update the documentation to show how to escape/replace '"' with '"'.

yq e -n '.someNew="content"'.replace('"','\"' )
yq e -n '{"wrap": .}' .replace('"','\"' ) name.yaml

I have not looked into what a similar *.bat or *.cmd file might look like.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions