command

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2018 License: BSD-3-Clause Imports: 9 Imported by: 2

README

Command activity

This activity allows you execute a command.

Installation

Flogo Web
Start

Start a container of Flogo Web UI :

docker run --name flogo -it -d -p 3303:3303 -e FLOGO_NO_ENGINE_RECREATION=false flogo/flogo-docker eula-accept

The environment variable FLOGO_NO_ENGINE_RECREATION=false allows to force import of installed contributions.

Installation of the activity

To install the activity into the started container :

docker exec -it flogo sh -c 'cd /tmp/flogo-web/build/server/local/engines/flogo-web && flogo install github.com/square-it/flogo-contrib-activities/command'

Restart the container

docker restart flogo
Flogo CLI
flogo install github.com/square-it/flogo-contrib-activities/command

Schema

Inputs and Outputs:

{
  "inputs":[
    {
      "name": "command",
      "type": "string",
      "required" : "true"
    },
    {
      "name": "arguments",
      "type": "array"
    },
    {
      "name": "directory",
      "type": "string"
    },
    {
      "name": "environment",
      "type": "array"
    },
    {
      "name":"useCurrentEnvironment",
      "type":"boolean",
      "value": true
    },
    {
      "name":"timeout",
      "type":"integer",
      "value": 0
    },
    {
      "name":"wait",
      "type":"boolean",
      "value": true
    }
  ],
  "outputs": [
    {
      "name": "output",
      "type": "string"
    },
    {
      "name": "exitCode",
      "type": "integer"
     },
    {
      "name":"success",
      "type":"boolean"
    }
  ]
 }

Settings

Setting Required Description
command True The command to be executed. it can be relative or absolute. if it is relative, the command is looked up in the PATH of the operating systeme.
arguments False The arguments of the command.
directory False The working directory of the command. Default value is the empty string, in this case execute the command in the current directory.
environment False The environment variables. The format of each element is "<name>=<value>".
useCurrentEnvironment False True to use the current environment variable. Default value : true.
timeout False The command is canceled if the number of timeout setting in seconds is exceeded. If this value is equals to 0, the command is never canceled. Default value : 0
wait False If wait is equals to true, wait the end of exection of the command, else don't wait the end of execution. Default value : true.

Outputs

Output Description
output The output of the command execution.
exitCode The exit code of the command exection. This value depends on the operating system. In case the operating system is not supported by the activity, the value will be 0 in case of success, -100 otherwise.
success True if the command execution is successful. False otherwise.

Examples

Simple example
{
  "id": "command_1",
  "name": "Command ls",
  "description": "List a directory",
  "activity": {
    "ref": "github.com/square-it/flogo-contrib-activities/command",
    "input": {
      "command": "ls"
    },
    "output": {
    }
  }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewActivity

func NewActivity(metadata *activity.Metadata) activity.Activity

NewActivity creates a new activity

Types

type CommandActivity

type CommandActivity struct {
	// contains filtered or unexported fields
}

CommandActivity is a stub for your Activity implementation

func (*CommandActivity) Eval

func (a *CommandActivity) Eval(activityContext activity.Context) (done bool, err error)

Eval implements activity.Activity.Eval

func (*CommandActivity) Metadata

func (a *CommandActivity) Metadata() *activity.Metadata

Metadata implements activity.Activity.Metadata

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL