How to escape indicator characters (i.e. : or - ) in YAML

后端 未结 7 2170
醉话见心
醉话见心 2020-11-27 12:13

In a config file, I have a key to which I wish to assign a URL. The problem is that YAML interprets : and - characters as either creating mappings or lists, so it has a pro

相关标签:
7条回答
  • 2020-11-27 12:42

    I came here trying to get my Azure DevOps Command Line task working. The thing that worked for me was using the pipe (|) character. Using > did not work.

    Example:

    steps:
    - task: CmdLine@2
      inputs:
        script: |
          echo "Selecting Mono version..."
          /bin/bash -c "sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_18_1"
          echo "Selecting Xcode version..."
          /bin/bash -c "echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_10.2.1.app;sudo xcode-select --switch /Applications/Xcode_10.2.1.app/Contents/Developer"
    
    0 讨论(0)
提交回复
热议问题