Skip to content

Example of sub commands with Args? #287

Answered by yaythomas
blaisep asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @blaisep, you were very almost there! Instead of |- (keep newlines, no newline at end) you should just be using > (folded, replace newlines w spaces).

  - name: pypyr.steps.cmd
    in:
      cmd: >
        echo
        one
        two
        three

This will pass echo one two three to the subprocess.

So this way you can break up your cmd over multiple lines in the yaml however you want, and then under the hood they will get folded back up into a single line when passed to the subprocess.

FYI, your second example would deffo not work, but it might be instructive to explain why. . .
when you go

- name: pypyr.steps.cmd
   in:
     cmd:
       - cmd1 --arg
       - cmd2 --blah
       - cm…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by blaisep
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants