Skip to content

Use #run to send multiline arguments #770

Description

@jensljungblad

Ran into a problem when converting a Ruby script to Thor.

With Ruby's system method, you can easily pass arguments that contain line-breaks:

body = <<-BODY.strip_heredoc
  String that
  spans multiple
  lines
BODY

# This works:
system("gh", "pr", "create", "--base", "master", "--title", title, "--body", body)

# Using Thor's `run` method does not:
run("gh pr create --base master --title #{title} --body #{body}")

Is there any way to use the run method in this type of scenario?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions