← All procedures

cli.run

Run a mark CLI command

CLI
Package
@procedures/cli-run · README
Path
["cli","run"]
CLI
mark cli run --path <string[]>
As data
{"$proc":["cli","run"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/cli-run"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["cli","run"], { path: [] });
console.log(JSON.stringify(result));

From the command line

$ mark cli run --path <string[]>

As data, in a program

{ "$proc": ["cli", "run"], "input": { "path": [] } }

Input

FieldTypeRequiredDefaultDescription
pathstring[]yesProcedure path to call, e.g. ["lib", "new"] for "mark lib new"
argsobjectnoNamed arguments as key-value pairs, e.g. { name: "foo" } -> "--name foo"
positionalstring[]noPositional arguments after the path
cwdstringnoWorking directory
timeoutnumbernoTimeout in milliseconds

Output

FieldTypeRequiredDefaultDescription
exitCodenumberyesThe exit code of mark
stdoutstringyesThe standard output of mark
stderrstringyesThe standard error of mark
successbooleanyesTrue when the exit code is 0
durationnumberyesThe time of the command, in milliseconds
JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "path": {
        "type": "array",
        "items": {
          "type": "string"
        },
        "description": "Procedure path to call, e.g. [\"lib\", \"new\"] for \"mark lib new\""
      },
      "args": {
        "description": "Named arguments as key-value pairs, e.g. { name: \"foo\" } -> \"--name foo\"",
        "type": "object",
        "propertyNames": {
          "type": "string"
        },
        "additionalProperties": {
          "type": [
            "string",
            "number",
            "boolean"
          ]
        }
      },
      "positional": {
        "description": "Positional arguments after the path",
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "cwd": {
        "description": "Working directory",
        "type": "string"
      },
      "timeout": {
        "description": "Timeout in milliseconds",
        "type": "number"
      }
    },
    "required": [
      "path"
    ]
  },
  "output": {
    "type": "object",
    "properties": {
      "exitCode": {
        "type": "number",
        "description": "The exit code of mark"
      },
      "stdout": {
        "type": "string",
        "description": "The standard output of mark"
      },
      "stderr": {
        "type": "string",
        "description": "The standard error of mark"
      },
      "success": {
        "type": "boolean",
        "description": "True when the exit code is 0"
      },
      "duration": {
        "type": "number",
        "description": "The time of the command, in milliseconds"
      }
    },
    "required": [
      "exitCode",
      "stdout",
      "stderr",
      "success",
      "duration"
    ],
    "additionalProperties": {}
  }
}