Skip to content

pipe option for customTools #221

@michaelwhitford

Description

@michaelwhitford

To upvote this issue, give it a thumbs up. See this list for the most upvoted issues.

I would like to be able to pipe a string of clojure code into my command without the shell expanding it. In python when you fork a process you can create a pipe, and feed that pipe data which is in turn piped into whatever command you are running. This bypasses shell expansion completely for special characters. Per a conversation on slack here is a theoretical config for a tool:

{
  "customTools": {
    "example-pipe-command": {
      "description": "A command that needs it's input piped.",
      "pipe-param": "code",
      "command": "clj-nrepl-eval -p {{port}}",
      "schema": {
        "code": {
          "type": "string",
          "description": "Code string is piped to the command."
        },
        "port": {
          "type": "string",
          "description": "Specify repl port."
        }
      },
      "required": ["code", "port"]
    }
  }
}

This would expand into something like echo {{code}} | clj-nrepl-eval -p 9000

You would have to pipe it in directly instead of using echo and the pipe symbol in the command since that would cause the shell to expand the string before it is piped.

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